I am a bit confused as to how to setup Cognito as a provider for account linking in Alexa. So far in Alexa, I have the following:
Authorization URL:
https://[domain].auth.us-east-1.amazoncognito.com/oauth2/authorize?response_type=code&client_id=[clientID]&redirect_uri=https://pitangui.amazon.com/api/skill/link/[random]
This is backed up by the docs for this endpoint. Then I would think that the Access Token URI would be following:
https://[domain].auth.us-east-1.amazoncognito.com/oauth2/token?grant_type=code&client_id=[clientID]&redirect_uri=https://pitangui.amazon.com/api/skill/link/[random]
This endpoint is also in the docs. But this does not work, and I also confused as to how Amazon passes the code from the auth endpoint to the token endpoint. I've seen people use:
https://pitangui.amazon.com/api/skill/link/[random]?grant_type=code&client_id=[clientID]&redirect_uri=https://pitangui.amazon.com/api/skill/link/[random]
Which is the account-linked redirect URI. In the Alexa app and in the Alexa site, I get redirect-mismatch. All the redirects match.
I can get this to work using the implicit flow just fine, but I need to get it to work with the auth code flow so I can have self-refreshing tokens.