- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我尝试将数据从 Rails 应用程序导出到 Google 日历,但登录后我无法在 request.env 中找到“omniauth.auth”。
我使用 Rails 4.0.4 和 Ruby 2.0.0p481
我的 gem 文件
gem 'google-api-client', '~> 0.7.1', :require => 'google/api_client'
gem 'omniauth', '~> 1.2.1'
gem 'omniauth-google-oauth2', '~> 0.2.4'
omniauth.rb
OmniAuth.config.full_host = "http://localhost:3000"
Rails.application.config.middleware.use OmniAuth::Builder do
provider :google_oauth2, 'MY_GOOGLE_CLIENT_ID', 'MY_GOOGLE_SECRET', { :access_type => 'offline', :prompt => 'consent', :approval_prompt => 'force', :scope => 'https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/calendar', :redirect_uri => 'http://localhost:3000/auth/google-oauth2/callback', }
end
Controller
class GoogleAuthController < ApplicationController
def create
@auth = request.env['omniauth.auth'] #here not found 'omniath.auth' and @auth is nil
if @auth.nil?
flash[:danger] = "Error during connection with Google API."
redirect_to holidays_path
else
@token = @auth['credential']['token']
#another action after login
end
end
end
路线
match "/auth/:provider/callback", to: "google_auth#create", via: 'get'
Google apis (I cannot add a image, )
如果您能帮助解决这个问题,我将非常感激。
编辑:
请求.env
{"GATEWAY_INTERFACE"=>"CGI/1.1", "PATH_INFO"=>"/auth/google-oauth2/callback", "QUERY_STRING"=>"state=fc29151421330cb904b4c4984bdd52e21a53d98531389b74&code=4/mi7TtHWcFpyMeeA-ikQHb6dV5Qki.grzx2bQTFb8dYFZr95uygvVpKDFKjgI", "REMOTE_ADDR"=>"127.0.0.1", "REMOTE_HOST"=>"127.0.0.1", "REQUEST_METHOD"=>"GET", "REQUEST_URI"=>"http://localhost:3000/auth/google-oauth2/callback?state=fc29151421330cb904b4c4984bdd52e21a53d98531389b74&code=4/mi7TtHWcFpyMeeA-ikQHb6dV5Qki.grzx2bQTFb8dYFZr95uygvVpKDFKjgI", "SCRIPT_NAME"=>"", "SERVER_NAME"=>"localhost", "SERVER_PORT"=>"3000", "SERVER_PROTOCOL"=>"HTTP/1.1", "SERVER_SOFTWARE"=>"WEBrick/1.3.1 (Ruby/2.0.0/2014-05-08)", "HTTP_HOST"=>"localhost:3000", "HTTP_USER_AGENT"=>"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:30.0) Gecko/20100101 Firefox/30.0", "HTTP_ACCEPT"=>"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", "HTTP_ACCEPT_LANGUAGE"=>"en-gb,pl;q=0.5", "HTTP_ACCEPT_ENCODING"=>"gzip, deflate", "HTTP_DNT"=>"1", "HTTP_COOKIE"=>"csrftoken=SlECAmtvbK9jqvqpS6D8nf2YMNdgGvnQ; holidays_view=list; logged_to_google=false; remember_token=EjYlew0u1zVPf21OfDA5hw; _HolidayManager_session=Zm43QVVrd2dKSkFLbnUvZnZLYzlhTVZ6QVNISDErYU5wVzg4ek90dFFoVXVZUHlpb1c3Q2NldGV1R05IellhbHNTYS92TFlLK1dMK3drR3p2bldXejVlbTJGaktnTXNyZWkzdnVJd05PQ3dyb0R0bndjeFV5S01CL1hybFVITzZRM1lqZWxGa1FFQnJ0ektWZUpwNlV2MnNnU3p2OVR2WnE0ME11aDNJZDNLekZSNm85MU9ZdWhZWVlGL0Y3dGdTS0E2NjI4Zk5EQ3Y5WHI1MWRUaC9JSEFwYjNpbkNtMmZ5RTdRWTF5ak1kQ2E5T1hwcFMzczRYZHpjYkxKNldxdzJDZDhreFNqWW9ySGhnNU02dmNwSzlQaUJDbVQrN2FhcFpQYzNHWWQ4OVp2VlVFTFAzQ1hLUWZ2aEJpUkg0Y3g0citJK3pMcU1VdUpNOEJxWTFhRGtMVEdhQVEyUGhxMzRmNytVUEczTmw3SEJQdk94dGZtUysvYVI1M3pjUTFlMmYxVGdFL0UrME5nTXNWblU5V0gvZzViMEJKSUhtbmRlZUo4RnB6VWkzQlBMaHlUYUZhY2xBZTg0TUxtdW44Zy0teUVlY1Y5bXNDRi9XdGxPWWIyNmsyQT09--7c4d0f8a5be4c25d7fbc8f9922425f267d7c9c10", "HTTP_CONNECTION"=>"keep-alive", "HTTP_CACHE_CONTROL"=>"max-age=0", "rack.version"=>[1, 2], "rack.input"=>#<StringIO:0x007fd805127750>, "rack.errors"=>#<IO:<STDERR>>, "rack.multithread"=>false, "rack.multiprocess"=>false, "rack.run_once"=>false, "rack.url_scheme"=>"http", "HTTP_VERSION"=>"HTTP/1.1", "REQUEST_PATH"=>"/auth/google-oauth2/callback", "ORIGINAL_FULLPATH"=>"/auth/google-oauth2/callback?state=fc29151421330cb904b4c4984bdd52e21a53d98531389b74&code=4/mi7TtHWcFpyMeeA-ikQHb6dV5Qki.grzx2bQTFb8dYFZr95uygvVpKDFKjgI", "ORIGINAL_SCRIPT_NAME"=>"", "action_dispatch.routes"=>#<ActionDispatch::Routing::RouteSet:0x00000002d54308>, "action_dispatch.parameter_filter"=>[:password], "action_dispatch.redirect_filter"=>[], "action_dispatch.secret_token"=>nil, "action_dispatch.secret_key_base"=>"d4b9400cc11ac95836a873c775f9597d9d6428bb4a3d82e3723da38bf04914735397b697d45dbeb6fa4b1a8719c6f87b2e333510d316e1a0f4b1ad40eecf0f8a", "action_dispatch.show_exceptions"=>true, "action_dispatch.show_detailed_exceptions"=>true, "action_dispatch.logger"=>#<Logger:0x000000012f8658 @progname=nil, @level=0, @default_formatter=#<Logger::Formatter:0x000000012f83d8 @datetime_format=nil>, @formatter=#<ActiveSupport::Logger::SimpleFormatter:0x000000012ff2f0 @datetime_format=nil>, @logdev=#<Logger::LogDevice:0x000000012fcfc8 @shift_size=nil, @shift_age=nil, @filename=nil, @dev=#<IO:<STDOUT>>, @mutex=#<Logger::LogDevice::LogDeviceMutex:0x000000012fd810 @mon_owner=nil, @mon_count=0, @mon_mutex=#<Mutex:0x000000012fee40>>>>, "action_dispatch.backtrace_cleaner"=>#<Rails::BacktraceCleaner:0x0000000427c168 @filters=[#<Proc:0x0000000428bac8@/home/damian/.rvm/gems/ruby-2.0.0-p481/gems/railties-4.0.4/lib/rails/backtrace_cleaner.rb:10>, #<Proc:0x0000000428baa0@/home/damian/.rvm/gems/ruby-2.0.0-p481/gems/railties-4.0.4/lib/rails/backtrace_cleaner.rb:11>, #<Proc:0x0000000428ba78@/home/damian/.rvm/gems/ruby-2.0.0-p481/gems/railties-4.0.4/lib/rails/backtrace_cleaner.rb:12>, #<Proc:0x000000042896b0@/home/damian/.rvm/gems/ruby-2.0.0-p481/gems/railties-4.0.4/lib/rails/backtrace_cleaner.rb:24>], @silencers=[#<Proc:0x00000004289570@/home/damian/.rvm/gems/ruby-2.0.0-p481/gems/railties-4.0.4/lib/rails/backtrace_cleaner.rb:15>]>, "action_dispatch.key_generator"=>#<ActiveSupport::CachingKeyGenerator:0x000000042893e0 @key_generator=#<ActiveSupport::KeyGenerator:0x00000004289408 @secret="d4b9400cc11ac95836a873c775f9597d9d6428bb4a3d82e3723da38bf04914735397b697d45dbeb6fa4b1a8719c6f87b2e333510d316e1a0f4b1ad40eecf0f8a", @iterations=1000>, @cache_keys=#<ThreadSafe::Cache:0x000000042893b8 @backend={"encrypted cookie64"=>"+&\x1E\x8D7h\x00l_3Z\x02\xCEYU\xE5\xD1\xAC-\xD7z\xE3\xF2\xD8\xA6Pn\x96\x84Cx\xDE\x98Z\xC5\x80js\xF7\xF8q\x04s\b\xCFf\x96v\x98~\xED\x9C\x11\xDE\xC1\xD8\x1Dz\x1DS\x12\xA4\xDF<", "signed encrypted cookie64"=>"\x86\xD9\xEC\xFFu\xE9\xA2\xC7z\xD8\x990\xDE+#s\xC1\x1E$\x1E;Jd\x8B\xA2\x9A\xB9\x05>\x01\xF5\xB6\x0E\xC0\x10\xD9\xD5\xF7\xBA[$\xC9m\xE65<}D\xA0b\xE7\xE8y\xCA6\x1F\x02\xA3S\x1F[\xFEk\xD1"}, @default_proc=nil>>, "action_dispatch.http_auth_salt"=>"http authentication", "action_dispatch.signed_cookie_salt"=>"signed cookie", "action_dispatch.encrypted_cookie_salt"=>"encrypted cookie", "action_dispatch.encrypted_signed_cookie_salt"=>"signed encrypted cookie", "ROUTES_23765380_SCRIPT_NAME"=>"", "action_dispatch.request_id"=>"bf2e900d-3cc9-4a21-88cf-12a2fdcbcc09", "action_dispatch.remote_ip"=>#<ActionDispatch::RemoteIp::GetIp:0x007fd805124d20 @env={...}, @check_ip=true, @proxies=/
^127\.0\.0\.1$ | # localhost IPv4
^::1$ | # localhost IPv6
^fc00: | # private IPv6 range fc00
^10\. | # private IPv4 range 10.x.x.x
^172\.(1[6-9]|2[0-9]|3[0-1])\.| # private IPv4 range 172.16.0.0 .. 172.31.255.255
^192\.168\. # private IPv4 range 192.168.x.x
/x>, "rack.session"=>#<ActionDispatch::Request::Session:0x007fd7f813b2d0 @by=#<ActionDispatch::Session::CookieStore:0x00000003db62f0 @app=#<ActionDispatch::Flash:0x00000003db6390 @app=#<ActionDispatch::ParamsParser:0x00000003db67a0 @app=#<Rack::Head:0x00000003db67c8 @app=#<Rack::ConditionalGet:0x00000003db67f0 @app=#<Rack::ETag:0x00000003db6818 @app=#<OmniAuth::Builder:0x00000003db7df8 @options=nil, @run=#<ActionDispatch::Routing::RouteSet:0x00000002d54308>, @map=nil, @use=[#<Proc:0x00000003db7420@/home/damian/.rvm/gems/ruby-2.0.0-p481/gems/rack-1.5.2/lib/rack/builder.rb:86>, #<Proc:0x00000003db6890@/home/damian/.rvm/gems/ruby-2.0.0-p481/gems/rack-1.5.2/lib/rack/builder.rb:86>]>, @cache_control="max-age=0, private, must-revalidate", @no_cache_control="no-cache">>>, @parsers={#<Mime::Type:0x00000002c92e60 @synonyms=["text/x-json", "application/jsonrequest"], @symbol=:json, @string="application/json">=>:json}>>, @default_options={:path=>"/", :domain=>nil, :expire_after=>nil, :secure=>false, :httponly=>true, :defer=>false, :renew=>false}, @key="_HolidayManager_session", @cookie_only=true>, @env={...}, @delegate={"session_id"=>"465d10f227d1b1033088b17f3aa77cb3", "_csrf_token"=>"SghTPesnhyoSKhA2yFhM4d20/KjqIPixcFUSCpn5jX4=", "omniauth.params"=>{}, "omniauth.state"=>"fc29151421330cb904b4c4984bdd52e21a53d98531389b74", "flash"=>{"discard"=>[:danger], "flashes"=>{:danger=>"Error during connection with Google API."}}}, @loaded=true, @exists=true>, "rack.session.options"=>#<ActionDispatch::Request::Session::Options:0x007fd7f813b280 @by=#<ActionDispatch::Session::CookieStore:0x00000003db62f0 @app=#<ActionDispatch::Flash:0x00000003db6390 @app=#<ActionDispatch::ParamsParser:0x00000003db67a0 @app=#<Rack::Head:0x00000003db67c8 @app=#<Rack::ConditionalGet:0x00000003db67f0 @app=#<Rack::ETag:0x00000003db6818 @app=#<OmniAuth::Builder:0x00000003db7df8 @options=nil, @run=#<ActionDispatch::Routing::RouteSet:0x00000002d54308>, @map=nil, @use=[#<Proc:0x00000003db7420@/home/damian/.rvm/gems/ruby-2.0.0-p481/gems/rack-1.5.2/lib/rack/builder.rb:86>, #<Proc:0x00000003db6890@/home/damian/.rvm/gems/ruby-2.0.0-p481/gems/rack-1.5.2/lib/rack/builder.rb:86>]>, @cache_control="max-age=0, private, must-revalidate", @no_cache_control="no-cache">>>, @parsers={#<Mime::Type:0x00000002c92e60 @synonyms=["text/x-json", "application/jsonrequest"], @symbol=:json, @string="application/json">=>:json}>>, @default_options={:path=>"/", :domain=>nil, :expire_after=>nil, :secure=>false, :httponly=>true, :defer=>false, :renew=>false}, @key="_HolidayManager_session", @cookie_only=true>, @env={...}, @delegate={:path=>"/", :domain=>nil, :expire_after=>nil, :secure=>false, :httponly=>true, :defer=>false, :renew=>false, :id=>"465d10f227d1b1033088b17f3aa77cb3"}>, "action_dispatch.request.path_parameters"=>{:controller=>"google_auth", :action=>"create", :provider=>"google-oauth2"}, "action_controller.instance"=>#<GoogleAuthController:0x007fd7f813db70 @_routes=nil, @_action_has_layout=true, @_headers={"Content-Type"=>"text/html"}, @_status=200, @_request=#<ActionDispatch::Request:0x007fd7f813da58 @env={...}, @symbolized_path_params=nil, @filtered_parameters={"state"=>"fc29151421330cb904b4c4984bdd52e21a53d98531389b74", "code"=>"4/mi7TtHWcFpyMeeA-ikQHb6dV5Qki.grzx2bQTFb8dYFZr95uygvVpKDFKjgI", "controller"=>"google_auth", "action"=>"create", "provider"=>"google-oauth2"}, @filtered_env=nil, @filtered_path=nil, @protocol=nil, @port=nil, @method="GET", @request_method="GET", @remote_ip=nil, @original_fullpath=nil, @fullpath="/auth/google-oauth2/callback?state=fc29151421330cb904b4c4984bdd52e21a53d98531389b74&code=4/mi7TtHWcFpyMeeA-ikQHb6dV5Qki.grzx2bQTFb8dYFZr95uygvVpKDFKjgI", @ip=nil, @uuid=nil>, @_response=#<ActionDispatch::Response:0x007fd7f813da30 @mon_owner=nil, @mon_count=0, @mon_mutex=#<Mutex:0x007fd7f813d990>, @stream=#<ActionDispatch::Response::Buffer:0x007fd7f813d8f0 @response=#<ActionDispatch::Response:0x007fd7f813da30 ...>, @buf=[], @closed=false>, @header={"X-Frame-Options"=>"SAMEORIGIN", "X-XSS-Protection"=>"1; mode=block", "X-Content-Type-Options"=>"nosniff", "X-UA-Compatible"=>"chrome=1"}, @status=200, @sending_file=false, @blank=false, @cv=#<MonitorMixin::ConditionVariable:0x007fd7f813d8c8 @monitor=#<ActionDispatch::Response:0x007fd7f813da30 ...>, @cond=#<ConditionVariable:0x007fd7f813d8a0 @waiters={}, @waiters_mutex=#<Mutex:0x007fd7f813d850>>>, @committed=false, @content_type=nil, @charset=nil, @cache_control={}, @etag=nil, @request=#<ActionDispatch::Request:0x007fd7f813da58 @env={...}, @symbolized_path_params=nil, @filtered_parameters={"state"=>"fc29151421330cb904b4c4984bdd52e21a53d98531389b74", "code"=>"4/mi7TtHWcFpyMeeA-ikQHb6dV5Qki.grzx2bQTFb8dYFZr95uygvVpKDFKjgI", "controller"=>"google_auth", "action"=>"create", "provider"=>"google-oauth2"}, @filtered_env=nil, @filtered_path=nil, @protocol=nil, @port=nil, @method="GET", @request_method="GET", @remote_ip=nil, @original_fullpath=nil, @fullpath="/auth/google-oauth2/callback?state=fc29151421330cb904b4c4984bdd52e21a53d98531389b74&code=4/mi7TtHWcFpyMeeA-ikQHb6dV5Qki.grzx2bQTFb8dYFZr95uygvVpKDFKjgI", @ip=nil, @uuid=nil>>, @_env={...}, @_prefixes=["google_auth", "application"], @_lookup_context=#<ActionView::LookupContext:0x007fd7f813d670 @details_key=nil, @details={:locale=>[:en], :formats=>[:html], :handlers=>[:erb, :builder, :raw, :ruby, :jbuilder, :coffee]}, @skip_default_locale=false, @cache=true, @prefixes=["google_auth", "application"], @rendered_format=nil, @view_paths=#<ActionView::PathSet:0x007fd7f813d5f8 @paths=[#<ActionView::OptimizedFileSystemResolver:0x000000040e0bd8 @pattern=":prefix/:action{.:locale,}{.:formats,}{.:handlers,}", @cache=#<ActionView::Resolver::Cache:0x000000040e0bb0 @data=#<ActionView::Resolver::Cache::SmallCache:0x000000040e0b88 @backend={#<ActionView::LookupContext::DetailsKey:0x0000000392d6c0 @hash=-2472005154318598025>=>#<ActionView::Resolver::Cache::SmallCache:0x0000000394bee0 @backend={"create"=>#<ActionView::Resolver::Cache::SmallCache:0x0000000394bbe8 @backend={"google_auth"=>#<ActionView::Resolver::Cache::SmallCache:0x0000000394b8a0 @backend={false=>#<ActionView::Resolver::Cache::SmallCache:0x0000000394b440 @backend={[]=>[app/views/google_auth/create.html.erb]}, @default_proc=nil>}, @default_proc=#<Proc:0x000000036d35f0@/home/damian/.rvm/gems/ruby-2.0.0-p481/gems/actionpack-4.0.4/lib/action_view/template/resolver.rb:45 (lambda)>>}, @default_proc=#<Proc:0x000000036d33c0@/home/damian/.rvm/gems/ruby-2.0.0-p481/gems/actionpack-4.0.4/lib/action_view/template/resolver.rb:46 (lambda)>>, "google_auth"=>#<ActionView::Resolver::Cache::SmallCache:0x00000003958bb8 @backend={"layouts"=>#<ActionView::Resolver::Cache::SmallCache:0x00000003961a88 @backend={false=>#<ActionView::Resolver::Cache::SmallCache:0x00000003963810 @backend={}, @default_proc=nil>}, @default_proc=#<Proc:0x000000036d35f0@/home/damian/.rvm/gems/ruby-2.0.0-p481/gems/actionpack-4.0.4/lib/action_view/template/resolver.rb:45 (lambda)>>}, @default_proc=#<Proc:0x000000036d33c0@/home/damian/.rvm/gems/ruby-2.0.0-p481/gems/actionpack-4.0.4/lib/action_view/template/resolver.rb:46 (lambda)>>, "application"=>#<ActionView::Resolver::Cache::SmallCache:0x00000003966f60 @backend={"layouts"=>#<ActionView::Resolver::Cache::SmallCache:0x00000003966e70 @backend={false=>#<ActionView::Resolver::Cache::SmallCache:0x00000003966b78 @backend={[]=>[app/views/layouts/application.html.erb]}, @default_proc=nil>}, @default_proc=#<Proc:0x000000036d35f0@/home/damian/.rvm/gems/ruby-2.0.0-p481/gems/actionpack-4.0.4/lib/action_view/template/resolver.rb:45 (lambda)>>}, @default_proc=#<Proc:0x000000036d33c0@/home/damian/.rvm/gems/ruby-2.0.0-p481/gems/actionpack-4.0.4/lib/action_view/template/resolver.rb:46 (lambda)>>, "navbar"=>#<ActionView::Resolver::Cache::SmallCache:0x007fd804e326d0 @backend={"layouts"=>#<ActionView::Resolver::Cache::SmallCache:0x007fd804e325e0 @backend={true=>#<ActionView::Resolver::Cache::SmallCache:0x007fd804e324f0 @backend={[]=>[app/views/layouts/_navbar.html.erb]}, @default_proc=nil>}, @default_proc=#<Proc:0x000000036d35f0@/home/damian/.rvm/gems/ruby-2.0.0-p481/gems/actionpack-4.0.4/lib/action_view/template/resolver.rb:45 (lambda)>>}, @default_proc=#<Proc:0x000000036d33c0@/home/damian/.rvm/gems/ruby-2.0.0-p481/gems/actionpack-4.0.4/lib/action_view/template/resolver.rb:46 (lambda)>>, "footer"=>#<ActionView::Resolver::Cache::SmallCache:0x007fd8050e52d8 @backend={"layouts"=>#<ActionView::Resolver::Cache::SmallCache:0x007fd8050e51e8 @backend={true=>#<ActionView::Resolver::Cache::SmallCache:0x007fd8050e50f8 @backend={[]=>[app/views/layouts/_footer.html.erb]}, @default_proc=nil>}, @default_proc=#<Proc:0x000000036d35f0@/home/damian/.rvm/gems/ruby-2.0.0-p481/gems/actionpack-4.0.4/lib/action_view/template/resolver.rb:45 (lambda)>>}, @default_proc=#<Proc:0x000000036d33c0@/home/damian/.rvm/gems/ruby-2.0.0-p481/gems/actionpack-4.0.4/lib/action_view/template/resolver.rb:46 (lambda)>>, "index"=>#<ActionView::Resolver::Cache::SmallCache:0x00000004243228 @backend={"holidays"=>#<ActionView::Resolver::Cache::SmallCache:0x00000004243138 @backend={false=>#<ActionView::Resolver::Cache::SmallCache:0x00000004242fd0 @backend={[]=>[app/views/holidays/index.html.erb]}, @default_proc=nil>}, @default_proc=#<Proc:0x000000036d35f0@/home/damian/.rvm/gems/ruby-2.0.0-p481/gems/actionpack-4.0.4/lib/action_view/template/resolver.rb:45 (lambda)>>}, @default_proc=#<Proc:0x000000036d33c0@/home/damian/.rvm/gems/ruby-2.0.0-p481/gems/actionpack-4.0.4/lib/action_view/template/resolver.rb:46 (lambda)>>, "holidays"=>#<ActionView::Resolver::Cache::SmallCache:0x00000004241d10 @backend={"layouts"=>#<ActionView::Resolver::Cache::SmallCache:0x00000004241bd0 @backend={false=>#<ActionView::Resolver::Cache::SmallCache:0x00000004241ab8 @backend={}, @default_proc=nil>}, @default_proc=#<Proc:0x000000036d35f0@/home/damian/.rvm/gems/ruby-2.0.0-p481/gems/actionpack-4.0.4/lib/action_view/template/resolver.rb:45 (lambda)>>}, @default_proc=#<Proc:0x000000036d33c0@/home/damian/.rvm/gems/ruby-2.0.0-p481/gems/actionpack-4.0.4/lib/action_view/template/resolver.rb:46 (lambda)>>}, @default_proc=#<Proc:0x000000036d3398@/home/damian/.rvm/gems/ruby-2.0.0-p481/gems/actionpack-4.0.4/lib/action_view/template/resolver.rb:47 (lambda)>>}, @default_proc=#<Proc:0x000000036d3348@/home/damian/.rvm/gems/ruby-2.0.0-p481/gems/actionpack-4.0.4/lib/action_view/template/resolver.rb:48 (lambda)>>>, @path="/home/damian/i4b/HolidayManager/branches/googleapis/HolidayManager/app/views">]>>, @_action_name="create", @_response_body=nil, @_config={}, @auth=nil, @result={...}>, "action_dispatch.request.content_type"=>nil, "action_dispatch.request.request_parameters"=>{}, "rack.request.query_string"=>"state=fc29151421330cb904b4c4984bdd52e21a53d98531389b74&code=4/mi7TtHWcFpyMeeA-ikQHb6dV5Qki.grzx2bQTFb8dYFZr95uygvVpKDFKjgI", "rack.request.query_hash"=>{"state"=>"fc29151421330cb904b4c4984bdd52e21a53d98531389b74", "code"=>"4/mi7TtHWcFpyMeeA-ikQHb6dV5Qki.grzx2bQTFb8dYFZr95uygvVpKDFKjgI"}, "action_dispatch.request.query_parameters"=>{"state"=>"fc29151421330cb904b4c4984bdd52e21a53d98531389b74", "code"=>"4/mi7TtHWcFpyMeeA-ikQHb6dV5Qki.grzx2bQTFb8dYFZr95uygvVpKDFKjgI"}, "action_dispatch.request.parameters"=>{"state"=>"fc29151421330cb904b4c4984bdd52e21a53d98531389b74", "code"=>"4/mi7TtHWcFpyMeeA-ikQHb6dV5Qki.grzx2bQTFb8dYFZr95uygvVpKDFKjgI", "controller"=>"google_auth", "action"=>"create", "provider"=>"google-oauth2"}, "action_dispatch.request.formats"=>[#<Mime::Type:0x00000002c7e2f8 @synonyms=["application/xhtml+xml"], @symbol=:html, @string="text/html">], "rack.request.cookie_hash"=>{"csrftoken"=>"SlECAmtvbK9jqvqpS6D8nf2YMNdgGvnQ", "holidays_view"=>"list", "logged_to_google"=>"false", "remember_token"=>"EjYlew0u1zVPf21OfDA5hw", "_HolidayManager_session"=>"Zm43QVVrd2dKSkFLbnUvZnZLYzlhTVZ6QVNISDErYU5wVzg4ek90dFFoVXVZUHlpb1c3Q2NldGV1R05IellhbHNTYS92TFlLK1dMK3drR3p2bldXejVlbTJGaktnTXNyZWkzdnVJd05PQ3dyb0R0bndjeFV5S01CL1hybFVITzZRM1lqZWxGa1FFQnJ0ektWZUpwNlV2MnNnU3p2OVR2WnE0ME11aDNJZDNLekZSNm85MU9ZdWhZWVlGL0Y3dGdTS0E2NjI4Zk5EQ3Y5WHI1MWRUaC9JSEFwYjNpbkNtMmZ5RTdRWTF5ak1kQ2E5T1hwcFMzczRYZHpjYkxKNldxdzJDZDhreFNqWW9ySGhnNU02dmNwSzlQaUJDbVQrN2FhcFpQYzNHWWQ4OVp2VlVFTFAzQ1hLUWZ2aEJpUkg0Y3g0citJK3pMcU1VdUpNOEJxWTFhRGtMVEdhQVEyUGhxMzRmNytVUEczTmw3SEJQdk94dGZtUysvYVI1M3pjUTFlMmYxVGdFL0UrME5nTXNWblU5V0gvZzViMEJKSUhtbmRlZUo4RnB6VWkzQlBMaHlUYUZhY2xBZTg0TUxtdW44Zy0teUVlY1Y5bXNDRi9XdGxPWWIyNmsyQT09--7c4d0f8a5be4c25d7fbc8f9922425f267d7c9c10"}, "rack.request.cookie_string"=>"csrftoken=SlECAmtvbK9jqvqpS6D8nf2YMNdgGvnQ; holidays_view=list; logged_to_google=false; remember_token=EjYlew0u1zVPf21OfDA5hw; _HolidayManager_session=Zm43QVVrd2dKSkFLbnUvZnZLYzlhTVZ6QVNISDErYU5wVzg4ek90dFFoVXVZUHlpb1c3Q2NldGV1R05IellhbHNTYS92TFlLK1dMK3drR3p2bldXejVlbTJGaktnTXNyZWkzdnVJd05PQ3dyb0R0bndjeFV5S01CL1hybFVITzZRM1lqZWxGa1FFQnJ0ektWZUpwNlV2MnNnU3p2OVR2WnE0ME11aDNJZDNLekZSNm85MU9ZdWhZWVlGL0Y3dGdTS0E2NjI4Zk5EQ3Y5WHI1MWRUaC9JSEFwYjNpbkNtMmZ5RTdRWTF5ak1kQ2E5T1hwcFMzczRYZHpjYkxKNldxdzJDZDhreFNqWW9ySGhnNU02dmNwSzlQaUJDbVQrN2FhcFpQYzNHWWQ4OVp2VlVFTFAzQ1hLUWZ2aEJpUkg0Y3g0citJK3pMcU1VdUpNOEJxWTFhRGtMVEdhQVEyUGhxMzRmNytVUEczTmw3SEJQdk94dGZtUysvYVI1M3pjUTFlMmYxVGdFL0UrME5nTXNWblU5V0gvZzViMEJKSUhtbmRlZUo4RnB6VWkzQlBMaHlUYUZhY2xBZTg0TUxtdW44Zy0teUVlY1Y5bXNDRi9XdGxPWWIyNmsyQT09--7c4d0f8a5be4c25d7fbc8f9922425f267d7c9c10", "action_dispatch.cookies"=>#<ActionDispatch::Cookies::CookieJar:0x007fd7ec19a638 @key_generator=#<ActiveSupport::CachingKeyGenerator:0x000000042893e0 @key_generator=#<ActiveSupport::KeyGenerator:0x00000004289408 @secret="d4b9400cc11ac95836a873c775f9597d9d6428bb4a3d82e3723da38bf04914735397b697d45dbeb6fa4b1a8719c6f87b2e333510d316e1a0f4b1ad40eecf0f8a", @iterations=1000>, @cache_keys=#<ThreadSafe::Cache:0x000000042893b8 @backend={"encrypted cookie64"=>"+&\x1E\x8D7h\x00l_3Z\x02\xCEYU\xE5\xD1\xAC-\xD7z\xE3\xF2\xD8\xA6Pn\x96\x84Cx\xDE\x98Z\xC5\x80js\xF7\xF8q\x04s\b\xCFf\x96v\x98~\xED\x9C\x11\xDE\xC1\xD8\x1Dz\x1DS\x12\xA4\xDF<", "signed encrypted cookie64"=>"\x86\xD9\xEC\xFFu\xE9\xA2\xC7z\xD8\x990\xDE+#s\xC1\x1E$\x1E;Jd\x8B\xA2\x9A\xB9\x05>\x01\xF5\xB6\x0E\xC0\x10\xD9\xD5\xF7\xBA[$\xC9m\xE65<}D\xA0b\xE7\xE8y\xCA6\x1F\x02\xA3S\x1F[\xFEk\xD1"}, @default_proc=nil>>, @set_cookies={"request_method"=>{:value=>"GET", :path=>"/"}}, @delete_cookies={}, @host="localhost", @secure=false, @options={:signed_cookie_salt=>"signed cookie", :encrypted_cookie_salt=>"encrypted cookie", :encrypted_signed_cookie_salt=>"signed encrypted cookie", :secret_token=>nil, :secret_key_base=>"d4b9400cc11ac95836a873c775f9597d9d6428bb4a3d82e3723da38bf04914735397b697d45dbeb6fa4b1a8719c6f87b2e333510d316e1a0f4b1ad40eecf0f8a", :upgrade_legacy_signed_cookies=>false}, @cookies={"csrftoken"=>"SlECAmtvbK9jqvqpS6D8nf2YMNdgGvnQ", "holidays_view"=>"list", "logged_to_google"=>"false", "remember_token"=>"EjYlew0u1zVPf21OfDA5hw", "_HolidayManager_session"=>"Zm43QVVrd2dKSkFLbnUvZnZLYzlhTVZ6QVNISDErYU5wVzg4ek90dFFoVXVZUHlpb1c3Q2NldGV1R05IellhbHNTYS92TFlLK1dMK3drR3p2bldXejVlbTJGaktnTXNyZWkzdnVJd05PQ3dyb0R0bndjeFV5S01CL1hybFVITzZRM1lqZWxGa1FFQnJ0ektWZUpwNlV2MnNnU3p2OVR2WnE0ME11aDNJZDNLekZSNm85MU9ZdWhZWVlGL0Y3dGdTS0E2NjI4Zk5EQ3Y5WHI1MWRUaC9JSEFwYjNpbkNtMmZ5RTdRWTF5ak1kQ2E5T1hwcFMzczRYZHpjYkxKNldxdzJDZDhreFNqWW9ySGhnNU02dmNwSzlQaUJDbVQrN2FhcFpQYzNHWWQ4OVp2VlVFTFAzQ1hLUWZ2aEJpUkg0Y3g0citJK3pMcU1VdUpNOEJxWTFhRGtMVEdhQVEyUGhxMzRmNytVUEczTmw3SEJQdk94dGZtUysvYVI1M3pjUTFlMmYxVGdFL0UrME5nTXNWblU5V0gvZzViMEJKSUhtbmRlZUo4RnB6VWkzQlBMaHlUYUZhY2xBZTg0TUxtdW44Zy0teUVlY1Y5bXNDRi9XdGxPWWIyNmsyQT09--7c4d0f8a5be4c25d7fbc8f9922425f267d7c9c10", "request_method"=>"GET"}, @encrypted=#<ActionDispatch::Cookies::EncryptedCookieJar:0x007fd7ec198e00 @parent_jar=#<ActionDispatch::Cookies::CookieJar:0x007fd7ec19a638 ...>, @options={:signed_cookie_salt=>"signed cookie", :encrypted_cookie_salt=>"encrypted cookie", :encrypted_signed_cookie_salt=>"signed encrypted cookie", :secret_token=>nil, :secret_key_base=>"d4b9400cc11ac95836a873c775f9597d9d6428bb4a3d82e3723da38bf04914735397b697d45dbeb6fa4b1a8719c6f87b2e333510d316e1a0f4b1ad40eecf0f8a", :upgrade_legacy_signed_cookies=>false}, @encryptor=#<ActiveSupport::MessageEncryptor:0x007fd7ec198cc0 @secret="+&\x1E\x8D7h\x00l_3Z\x02\xCEYU\xE5\xD1\xAC-\xD7z\xE3\xF2\xD8\xA6Pn\x96\x84Cx\xDE\x98Z\xC5\x80js\xF7\xF8q\x04s\b\xCFf\x96v\x98~\xED\x9C\x11\xDE\xC1\xD8\x1Dz\x1DS\x12\xA4\xDF<", @sign_secret="\x86\xD9\xEC\xFFu\xE9\xA2\xC7z\xD8\x990\xDE+#s\xC1\x1E$\x1E;Jd\x8B\xA2\x9A\xB9\x05>\x01\xF5\xB6\x0E\xC0\x10\xD9\xD5\xF7\xBA[$\xC9m\xE65<}D\xA0b\xE7\xE8y\xCA6\x1F\x02\xA3S\x1F[\xFEk\xD1", @cipher="aes-256-cbc", @verifier=#<ActiveSupport::MessageVerifier:0x007fd7ec198bd0 @secret="\x86\xD9\xEC\xFFu\xE9\xA2\xC7z\xD8\x990\xDE+#s\xC1\x1E$\x1E;Jd\x8B\xA2\x9A\xB9\x05>\x01\xF5\xB6\x0E\xC0\x10\xD9\xD5\xF7\xBA[$\xC9m\xE65<}D\xA0b\xE7\xE8y\xCA6\x1F\x02\xA3S\x1F[\xFEk\xD1", @digest="SHA1", @serializer=ActiveSupport::MessageEncryptor::NullSerializer>, @serializer=Marshal>>, @signed_or_encrypted=#<ActionDispatch::Cookies::EncryptedCookieJar:0x007fd7ec198e00 @parent_jar=#<ActionDispatch::Cookies::CookieJar:0x007fd7ec19a638 ...>, @options={:signed_cookie_salt=>"signed cookie", :encrypted_cookie_salt=>"encrypted cookie", :encrypted_signed_cookie_salt=>"signed encrypted cookie", :secret_token=>nil, :secret_key_base=>"d4b9400cc11ac95836a873c775f9597d9d6428bb4a3d82e3723da38bf04914735397b697d45dbeb6fa4b1a8719c6f87b2e333510d316e1a0f4b1ad40eecf0f8a", :upgrade_legacy_signed_cookies=>false}, @encryptor=#<ActiveSupport::MessageEncryptor:0x007fd7ec198cc0 @secret="+&\x1E\x8D7h\x00l_3Z\x02\xCEYU\xE5\xD1\xAC-\xD7z\xE3\xF2\xD8\xA6Pn\x96\x84Cx\xDE\x98Z\xC5\x80js\xF7\xF8q\x04s\b\xCFf\x96v\x98~\xED\x9C\x11\xDE\xC1\xD8\x1Dz\x1DS\x12\xA4\xDF<", @sign_secret="\x86\xD9\xEC\xFFu\xE9\xA2\xC7z\xD8\x990\xDE+#s\xC1\x1E$\x1E;Jd\x8B\xA2\x9A\xB9\x05>\x01\xF5\xB6\x0E\xC0\x10\xD9\xD5\xF7\xBA[$\xC9m\xE65<}D\xA0b\xE7\xE8y\xCA6\x1F\x02\xA3S\x1F[\xFEk\xD1", @cipher="aes-256-cbc", @verifier=#<ActiveSupport::MessageVerifier:0x007fd7ec198bd0 @secret="\x86\xD9\xEC\xFFu\xE9\xA2\xC7z\xD8\x990\xDE+#s\xC1\x1E$\x1E;Jd\x8B\xA2\x9A\xB9\x05>\x01\xF5\xB6\x0E\xC0\x10\xD9\xD5\xF7\xBA[$\xC9m\xE65<}D\xA0b\xE7\xE8y\xCA6\x1F\x02\xA3S\x1F[\xFEk\xD1", @digest="SHA1", @serializer=ActiveSupport::MessageEncryptor::NullSerializer>, @serializer=Marshal>>>, "action_dispatch.request.unsigned_session_cookie"=>{"session_id"=>"465d10f227d1b1033088b17f3aa77cb3", "_csrf_token"=>"SghTPesnhyoSKhA2yFhM4d20/KjqIPixcFUSCpn5jX4=", "omniauth.params"=>{}, "omniauth.state"=>"fc29151421330cb904b4c4984bdd52e21a53d98531389b74", "flash"=>{"discard"=>[:danger], "flashes"=>{:danger=>"Error during connection with Google API."}}}}
编辑2:
好的。我定位了问题。当我在omniauth.rb中评论选项时,它记录了我
{ :access_type => 'offline', :prompt => 'consent', :approval_prompt => 'force', :scope => 'https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/calendar', :redirect_uri => 'http://localhost:3000/auth/google-oauth2/callback', }
最佳答案
查看 request.env
哈希值,没有 omniauth.auth
键 - 有一个 omniauth.state
键...也许这就是你想要的?
env
哈希值的末尾还包含以下内容:
unsigned_session_cookie"=>{
"session_id"=>"465d10f227d1b1033088b17f3aa77cb3",
"_csrf_token"=>"SghTPesnhyoSKhA2yFhM4d20/KjqIPixcFUSCpn5jX4=",
"omniauth.params"=>{},
"omniauth.state"=>"fc29151421330cb904b4c4984bdd52e21a53d98531389b74",
"flash"=>{
"discard"=>[:danger],
"flashes"=>{:danger=>"Error during connection with Google API."}}
}
}
这可能只是连接问题,正如该闪现消息似乎暗示的那样。
关于ruby-on-rails - request.env ['omniauth.auth' ] 在 Ruby on Rails 中为零,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24694460/
我需要将文本放在 中在一个 Div 中,在另一个 Div 中,在另一个 Div 中。所以这是它的样子: #document Change PIN
奇怪的事情发生了。 我有一个基本的 html 代码。 html,头部, body 。(因为我收到了一些反对票,这里是完整的代码) 这是我的CSS: html { backgroun
我正在尝试将 Assets 中的一组图像加载到 UICollectionview 中存在的 ImageView 中,但每当我运行应用程序时它都会显示错误。而且也没有显示图像。 我在ViewDidLoa
我需要根据带参数的 perl 脚本的输出更改一些环境变量。在 tcsh 中,我可以使用别名命令来评估 perl 脚本的输出。 tcsh: alias setsdk 'eval `/localhome/
我使用 Windows 身份验证创建了一个新的 Blazor(服务器端)应用程序,并使用 IIS Express 运行它。它将显示一条消息“Hello Domain\User!”来自右上方的以下 Ra
这是我的方法 void login(Event event);我想知道 Kotlin 中应该如何 最佳答案 在 Kotlin 中通配符运算符是 * 。它指示编译器它是未知的,但一旦知道,就不会有其他类
看下面的代码 for story in book if story.title.length < 140 - var story
我正在尝试用 C 语言学习字符串处理。我写了一个程序,它存储了一些音乐轨道,并帮助用户检查他/她想到的歌曲是否存在于存储的轨道中。这是通过要求用户输入一串字符来完成的。然后程序使用 strstr()
我正在学习 sscanf 并遇到如下格式字符串: sscanf("%[^:]:%[^*=]%*[*=]%n",a,b,&c); 我理解 %[^:] 部分意味着扫描直到遇到 ':' 并将其分配给 a。:
def char_check(x,y): if (str(x) in y or x.find(y) > -1) or (str(y) in x or y.find(x) > -1):
我有一种情况,我想将文本文件中的现有行包含到一个新 block 中。 line 1 line 2 line in block line 3 line 4 应该变成 line 1 line 2 line
我有一个新项目,我正在尝试设置 Django 调试工具栏。首先,我尝试了快速设置,它只涉及将 'debug_toolbar' 添加到我的已安装应用程序列表中。有了这个,当我转到我的根 URL 时,调试
在 Matlab 中,如果我有一个函数 f,例如签名是 f(a,b,c),我可以创建一个只有一个变量 b 的函数,它将使用固定的 a=a1 和 c=c1 调用 f: g = @(b) f(a1, b,
我不明白为什么 ForEach 中的元素之间有多余的垂直间距在 VStack 里面在 ScrollView 里面使用 GeometryReader 时渲染自定义水平分隔线。 Scrol
我想知道,是否有关于何时使用 session 和 cookie 的指南或最佳实践? 什么应该和什么不应该存储在其中?谢谢! 最佳答案 这些文档很好地了解了 session cookie 的安全问题以及
我在 scipy/numpy 中有一个 Nx3 矩阵,我想用它制作一个 3 维条形图,其中 X 轴和 Y 轴由矩阵的第一列和第二列的值、高度确定每个条形的 是矩阵中的第三列,条形的数量由 N 确定。
假设我用两种不同的方式初始化信号量 sem_init(&randomsem,0,1) sem_init(&randomsem,0,0) 现在, sem_wait(&randomsem) 在这两种情况下
我怀疑该值如何存储在“WORD”中,因为 PStr 包含实际输出。? 既然Pstr中存储的是小写到大写的字母,那么在printf中如何将其给出为“WORD”。有人可以吗?解释一下? #include
我有一个 3x3 数组: var my_array = [[0,1,2], [3,4,5], [6,7,8]]; 并想获得它的第一个 2
我意识到您可以使用如下方式轻松检查焦点: var hasFocus = true; $(window).blur(function(){ hasFocus = false; }); $(win
我是一名优秀的程序员,十分优秀!