question

Shrey avatar image
Shrey asked ·

Account linking issue with okta on ios

I’ve trying to perform alexa account linking from iOS app using all the steps provided in the guide.

We are using OKTA in our iOS app to login. I have added all the configuration in the account linking tab of Alexa skill developer portal.

The APIs in the below steps are consumed from iOS application using swift 5.


The Alexa skill is still under development and i have invited my self for beta testing. The invitation is also accepted but enablement and linking needs to be done from the iOS app.


STEP 1 : Calling ALEXA URL or Fallback URL for amazon auth code

Alexa url — 
https://alexa.amazon.com/spa/skill-account-linking-consent?fragment=skill-account-linking-consent&client_id=(kAlexaClientID)&scope=alexa::skills:account_linking&skill_stage=(kStage)&response_type=code&redirect_uri=(kRedirectURL)&sto kRedirectURL)&state=(kState)

Received Auth code from Alexa url.


STEP 2: Amazon Access token

Using amazon auth code, requested for Amazon Access token and refresh token.

Received both tokens.


STEP 3: Get Alexa endpoint

Using amazon access token, fetched Alexa api url.

Received api url.


STEP 4: Auth Code from OKTA

Using auth code URL from OKTA,

https://{oktadomain}/oauth2/default/v1/authorize?client_id={clientID}&response_type=code&scope=openid%20profile%20offline_access&redirect_uri={redirect_url}&state=state-296bc9a0-a2a2-4a57-be1a-d0e2fd9bb601

Logged into the account, and fetched the Auth code.


STEP 5: Skill Enablement API

Using the Okta Auth code, Alexa end point, amazon access token and the request body below, called the skill enablement API.

{
    "stage": "development",
    "accountLinkRequest": {
      "redirectUri": “{redirect URL here}”,
      "authCode": “{ Okta Auth code here}”,
      "type": "AUTH_CODE"
    }
}


Response from API -

STATUS - 400 BAD REQUEST 
{
    "message": "Invalid account linking credentials"
}

Don’t know what is causing this issue, unable to debug it.


Can someone help me out here?

account linkingaccount-linki
10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

Chihiro@Amazon avatar image
Chihiro@Amazon answered ·

Hi Shrey,

Thank you for posting. If you are still having the same issue, could you provide skill ID and timestamp in UTC for investigation? Also, please double check if you have correct header for Alexa Skill Activation API.

https://developer.amazon.com/en-US/docs/alexa/account-linking/skill-activation-api.html#post-request-enablement

10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.