ginjo / omniauth-slack

omniauth-slack ruby gem
https://rubygems.org/gems/ginjo-omniauth-slack
MIT License
42 stars 31 forks source link

Auth hash in new version #14

Open richardonrails opened 4 years ago

richardonrails commented 4 years ago

I'm working on something new and have been playing with this gem before and after this 2.5.0 update

I see now the Auth hash is pretty barebones:

The omniauth-slack gem will now copy the access-token hash to the AuthHash info section, but it will no longer be mapping specific data points from the access-token to specific fields in the AuthHash info section (other than info fields that are 'required' by the OmniAuth::AuthHash schema spec).

Some misc feedback/questions:

In my case I'm trying to allow Sign in with Slack but also grabbing/storing some additional information about their team from users.list. Slightly confused regarding putting e.g. my users.list API call in the Strategy, the OmniauthCallbacksController, or User.from_omniauth. Also trying to plan for other providers besides Slack. This is what made me think it was odd to put non-standard fields in the info section of AuthHash, but I'm not sure.

richardonrails commented 4 years ago

With how the gem is in 2.5.0, I think you also need to remove the entire skip_info section of the README, as it appears that option is no longer used at all. https://github.com/ginjo/omniauth-slack/tree/master#skip_info-boolean

SirRawlins commented 2 years ago

@richardonrails @ginjo finding myself in a similar scenario after an upgrade to 2.5.0.

At the moment I can only gain access to the user email address through:

env['omniauth.strategy'].access_token.authed_user.get('/api/users.identity').parsed

Any advice on a better way to access the authorizing user's email? I like the new approach to the flexible, progressive info hash in principle, but I'm a little lost as to how to use it.

Am I doing this right? Or am I missing something?