Permalink
Browse files

Add an example setup file for Rails.

Include configuration to remember user's Oauth consent -- preventing passing approval_prompt=force.
  • Loading branch information...
1 parent f0a7140 commit 2ab7535e51032325f54759f42579974ea862857b @whatcould committed Jan 12, 2012
Showing with 6 additions and 0 deletions.
  1. +6 −0 examples/omni_auth.rb
@@ -0,0 +1,6 @@
+Rails.application.config.middleware.use OmniAuth::Builder do
+ # If you don't need a refresh token -- if you're only using Google for account creation/auth and don't need google services -- set the access_type to 'online'.
+ # Also, set the approval prompt to an empty string, since otherwise it will be set to 'force', which makes users manually approve to the Oauth every time they log in.
+ # See http://googleappsdeveloper.blogspot.com/2011/10/upcoming-changes-to-oauth-20-endpoint.html
+ provider :google_oauth2, ENV['GOOGLE_KEY'], ENV['GOOGLE_SECRET'], {access_type: 'online', approval_prompt: ''}
+end

0 comments on commit 2ab7535

Please sign in to comment.