laravel / socialite

Laravel wrapper around OAuth 1 & OAuth 2 libraries.
https://laravel.com/docs/socialite
MIT License
5.55k stars 939 forks source link

Can't get bot slack user and bot tokens #681

Closed atymic closed 9 months ago

atymic commented 9 months ago

Slack's API allows you to pass both user_scopes and scopes in the same request. When receiving the access token body, it will have both tokens.

Currently it's not possible to get both tokens, as if you set user scopes the bot scopes are null'd out.

I propose adding a new method, withUserScopes. When this is set alongside asBotUser, the both the access token for the user and the bot access token will be returned.

If anyone else has a better suggestion let me know.

cc @ataldev

atymic commented 9 months ago

I've PR'd a fixed provider to the socialite providers repo, which allows you to set both scopes, and gives you the ability to access the raw token response via socialite's accessTokenResponseBody on the user object.

https://github.com/SocialiteProviders/Providers/pull/1136

I guess making it work as the above PR would be a breaking change, so open to something else

crynobone commented 9 months ago

This might be best reported to https://github.com/SocialiteProviders/Providers

atymic commented 9 months ago

@crynobone this is actually an issue with this provider. I just copied the provider for that PR, but ideally we'd update this as it's the main provider.

maartenpaauw commented 5 months ago

@crynobone I believe this issue needs to be reopened as it concerns the official Slack Socialite provider. Furthermore, the socialiteproviders/slack package is flagged as deprecated and directs users to the official Slack Socialite provider for substitution.

atymic commented 5 months ago

@m1guelpf could you please un-archive the slack provider? I will update the docs https://packagist.org/packages/socialiteproviders/slack

m1guelpf commented 5 months ago

@atymic done

atymic commented 5 months ago

@maartenpaauw docs are updated now and unarchived :)

Thanks @m1guelpf :)