question

tkw722 avatar image
tkw722 asked

Incorrect Client ID Returned From [AIMobileLib getClientId]

Hi All, I'm continuing to work towards getting my iOS app and device working with the Alexa Voice service, but am still wading through getting Amazon Login to work. I have the full flow built from the user clicking the login with amazon button, to signing in, to retrieving the authorization code, sending that code along with the client_id and the redirect_uri back to my device, then issuing the call to Amazon to retrieve the access token on the device. This is where I'm running into trouble. My device is calling out to retrieve the access token, but is receiving a 400 unauthorized client. When I dug in further I found that the client_id my device received from the iOS app (and is subsequently sending for along for the access token), is wrong. Or at least it doesn't match the client_id defined in my security profile page within the Alexa Voice Service config for this product. I'm not sure where the iOS app fetches that info from. Should I be using the one the iOS app returns? Or should I hard code the one from the security profile into my device to send? Best, Tim
login with amazon
10 |5000

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

tkw722 avatar image
tkw722 answered
I hard coded the client_id from my device security profile into the access token request and now it seems I've made some progress. I also had to include my client_secret as I received an error response stating so. The client_secret being required seems missing from the documentation on: https://developer.amazon.com/public/solutions/alexa/alexa-voice-service/docs/authorizing-your-alexa-enabled-product-from-an-android-or-ios-mobile-app Also, that page is a little confusing when it states that the client_id can be retrieved using [AIMobileLib getClientId] on the iOS side when it seems in fact you need the client_id for the product that is performing the access token request. Now though that I have those two things sorted out, I've run into a new error, with the redirect_uri. { error_description : The request has an invalid grant parameter : redirect_uri, error : invalid_grant } Again, this parameter, as the documentation describes is suppose to be retrieved in iOS using [AIMobileLib getRedirectUri], but I suspect that it in fact wants a redirect_uri for the device itself. What will be the correct redirect_uri here? Am I suppose to use one of the "Allowed Return URLs" from the "Web Settings" of the product configuration? My only concern with that and with this product very often existing within someone's home network and in turn being behind a firewall, is the issue of port forwarding. How can I have a redirect_uri on a device internal to someone's network?
10 |5000

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

tkw722 avatar image
tkw722 answered
I'm going to mark this as answered since my original question has been dealt with. I'm still running into trouble with the redirect_uri but I'll put that under a new post.
10 |5000

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