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

SlackJsonTokenExtractor bug when access_token is not found in response body #1023

Open
jaxony opened this issue Oct 8, 2021 · 0 comments
Open

Comments

@jaxony
Copy link

jaxony commented Oct 8, 2021

Hi there! I'm in the process of migrating Slack V1 App to V2 but ran into an error.

The code here expects that access_token is required, but in fact with Slack V2, access_token (meaning the "bot token") can be missing from the response object if the client only requested for "user-scoped permissions". See Slack oauth.v2.access docs.

return createToken(extractRequiredParameter(response, OAuthConstants.ACCESS_TOKEN, rawResponse).asText(),

A proposed solution is to override the OAuth2AccessTokenJsonExtractor#createToken(String rawResponse) method in SlackJsonTokenExtractor, making the access token an optional parameter instead of a required one.

Happy to do the PR for this if the owner is happy with the proposed solution 😄

peterp-canva added a commit to peterp-canva/scribejava that referenced this issue Apr 28, 2022
Issue: scribejava#1023
Slack does not always provide the bot access token, if you don't ask for those scopes.
This 

Note - the underlying OAuth2AccessToken has a Precondition for "access_token can't be null", so here it is provided with an empty string.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant