sorcery
sorcery copied to clipboard
[question] - Adding google prompt in Oauth2
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 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.