Hello,
I’m attempting to fetch the oauth token as described in the docs here.
I suspect this is due to my lack of understanding as to how I should be connecting to oauth.
My method to handle the oauth redirect request
This server method is called as soon as the user clicks “allow” then reaches the redirect_uri from step 2 in the doc: https://mysite.com/oauth/redirect?code=onetimecode&state=login
When the method above is called to handle the oauth redirect, I’d currently like to log the token response then redirect the user to https://mysite.com/dashboard
.
When setting the redirect_uri to https://mysite.com/dashboard
, the token request gives the following 400 response:
data: {
error: 'invalid_request',
error_description: 'Mismatching redirect URI.'
}
Strangely, if I change that redirect_uri back to the same url https://mysite.com/oauth/redirect
, the request succeeds, but proceeds to redirect to the same path and fail on second/third request because the one-time code has already been used, throwing an error.
Extra notes:
All urls are https
All urls have been added to the client key, including both https://mysite.com/oauth/redirect
and https://mysite.com/dashboard
and has been re-verified multiple times
There seems to be something I’m not understanding about how I should be using the redirect_uri property. Any explanation is appreciated.