'Amazon Alexa link account redirect url not working
I want to integrate an Amazon Alexa skill with a b2c shop with spartacus frontend deployed in dev stage with localtunel and hybris backend deloyed with ngrok. In order to do that I need the bellow settings:
The ngrok link redirects to my local instance: https://localhost:9002
In the Alexa app, when I click to account linking, I`m redirected to my login page. The url contains the following query parameters: client_id, response_type, state, scope, redirect_uri. After a successful login, the app redirects the user to the link provided in the redirect_uri parameter. Next, the excepted behavior would be a confirmation page that says the account linking was successful, but I only get this page: https://skills-store.amazon.com/external/link-result?success=false&isRTL=&errorKey=missing-state&languageCode=en_US
What could be the problem?
My first thought was the port. As you can see, my Hybris backend is on port 9002, just like the authorizationserver. But maybe the Alexa OAuth2.0 requests works only on port 443. If thats the case, how can I set SAP Hybris OAuth2.0 server to listen on port 443 instead of 9002?
Or I missed some query parameter from the redirect uri? I just redirect the user like this: window.location.href = this.route.snapshot.queryParams['redirect_uri']; An example of the link that redirets to the login page (first link fron the picture above):
Thank you for any suggestion or help!
UPDATE!
I also tried to add some additional parameters to the redirect url, but still nothing seems work. Now my url looks like this: https://pitangui.amazon.com/api/skill/link/M1OSM6ENO2AITV&state=state_from_alexa&access_token=token_from_server&token_type=Bearer
I also tried with # instead of & before the token.
Solution 1:[1]
You were almost there, your issue is that your url doesn't contain a valid GET parameter.
The first GET parameter starts with ?
and not &
GET parameters always start with a question mark ?. This is followed by the name of the variable and the corresponding value, separated by an =. If an URL contains more than one parameter, they are separated by an Ampersand &.
Update
to
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | callmemath |