I’m following the Sign in with Slack guide to create a user OAuth token and I want to validate the token when a user makes a request to my server, it looks like I should do this using the auth.test
method, but when I call it with the generated token the request fails with:
{
"ok": false,
"error": "invalid_auth"
}
What I’ve tried
- Using the generated OAuth token in the API tester (that’s on the
auth.test
documentation page) and it fails there too. - Using a bot OAuth token instead of the Oauth token, that works fine, but I want to validate tokens of users accessing protected routes on my server so the bot token isn’t going to work.
- calling the
openid.connect.userInfo
endpoint with the OAuth token, that works and I can see details of the logged in user but theauth.test
method has a higher rate limit, and according to the docsauth.test
should also support user OAuth tokens so that feels like the correct thing to use.
The documentation for the auth.test
method says no user scopes are required, I request openid
, email
and profile
scopes and the openid
scope is accepted according to the openid.connect.userInfo
response.
The user OAuth token I’m passing to the auth.test
methos is of the format:
xoxp-xxxxxxxxxxxxx-xxxxxxxxxxxxx-xxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Any idea why the auth.test
method fails when giving it a token that seems to be a valid user OAuth token (since the openid.connect.userInfo
endpoint works), and how I can get the method to work?
1