Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[question] - Adding google prompt in Oauth2 #301

Open
matoni109 opened this issue Jan 12, 2022 · 1 comment
Open

[question] - Adding google prompt in Oauth2 #301

matoni109 opened this issue Jan 12, 2022 · 1 comment
Labels
question Asking a question about Sorcery

Comments

@matoni109
Copy link

Hi Everyone,

Below is from Devise, just wanting to add prompt into the Sorcery initializer but unsure how to get that to work?

Any assistance would be great :)

/* sorcery.rb */

# /oauth/:provider
  config.google.key = ENV['GOOGLE_OAUTH_CLIENT_ID']
  config.google.secret = ENV['GOOGLE_OAUTH_CLIENT_SECRET']
  config.google.callback_url = 'https://wheelhouse-test-chriswade.ngrok.io/oauth/callback?provider=google'
  config.google.user_info_mapping = { email: 'email', username: 'name', image: 'picture' }
  config.google.scope = 'email profile https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile openid'

/* devise.rb */

  config.omniauth :google_oauth2, ENV['GOOGLE_OAUTH_CLIENT_ID'], ENV['GOOGLE_OAUTH_CLIENT_SECRET'],
                  {
                    scope: 'userinfo.email, userinfo.profile',
                    prompt: 'select_account',
                    image_aspect_ratio: 'square',
                    image_size: 50
                  }
@matoni109 matoni109 changed the title Adding google prompt in Oauth2 [question] - Adding google prompt in Oauth2 Jan 12, 2022
@joshbuker joshbuker added the question Asking a question about Sorcery label Jan 13, 2022
@joshbuker
Copy link
Member

@matoni109 You might be able to monkey patch the Google provider to add the additional params. Sorcery currently doesn't support it natively. For Sorcery v1, I'm planning on migrating us to using OmniAuth for the providers, in which case it would behave similarly (if not identically) to how Devise does it. That would still be a ways away though, so for now monkey patching or submitting a PR to add this would be your best bet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Asking a question about Sorcery
Projects
None yet
Development

No branches or pull requests

2 participants