I am following the OAUTH flow, getting the code, then using that to get an access token. However, the access token I get back does not work. I have a feeling I am doing something wrong here, but am unclear what. I have looked for other similar issues and can't quite find what I am looking for.
I am not sending any scopes in the login request. When I get the code, I use it to get a token:
request {
grant_type: 'authorization_code',
client_id: '*****',
client_secret: '*****',
redirect_uri: '*****',
code: '*****'
}
response {
access_token: '**ACCESS TOKEN**',
token_type: 'Bearer',
user: {
id: 2,
name: 'Example Student',
global_id: '*****',
effective_locale: 'en'
},
refresh_token: '*****',
expires_in: 3600
}
Then, I do another request, putting in the HTTP Header:
Authorization: 'Bearer **ACCESS TOKEN**'
I always get:
Error: failed [401] {"errors":[{"message":"Invalid access token."}]}
I created an access token from the development dashboard, and the API request works with that token (which is the same format as the one I get back in the OAUTH flow).
But that seems to defeat part of the purpose. It seems I would want to make the API calls as the user who is logged in, and not using my developer token.
Any guidance on what I am doing incorrectly would be greatly appreciated!
This discussion post is outdated and has been archived. Please use the Community question forums and official documentation for the most current and accurate information.