question

jack avatar image
jack asked ·

Can't get access token: InternalFailure:http://internal.amazon.com/coral/com.amazon.coral.service

I'm trying to add amazon sign in following "The Authorization CodeGrant" I get the code client side and send it to my node js express server but can't get the access token from amazon. I get 500 Internal Storage Error and:

x-amzn-errortype': 'InternalFailure:http://internal.amazon.com/coral/com.amazon.coral.service/'

My code:

async function getAmazonAccessTokenFromCode(code) {
    try {
        const { data } = await axios({
        url: 'https://api.amazon.com/auth/o2/token',
        method: 'POST',
        headers: {
        "Content-type": "application/x-www-form-urlencoded"
        },
        params: {
            grant_type: "authorization_code",
            code,
            client_id: "my_client_id",
            client_secret: "my_client_secret"
            redirect_uri: 'http://localhost:3000/amazon-auth',
        }
    })
    console.log("data", data)
    // console.log(data) // { access_token, token_type, expires_in, refresh_token }
    return data.access_token
    } catch (err) {
    console.log("err", err)
    return null
    }
}

Any help would be much appreciated!


login with amazon
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

npatten avatar image
npatten answered ·

Did you find a solution to this?
I'm having the exact same issue.

POST /auth/o2/token HTTP/1.1
Host: api.amazon.com
Content-Type: application/x-www-form-urlencoded;charset=UTF-8

grant_type=refresh_token
&refresh_token=Atzr|...
&client_id=amzn1.application-oa2-client.<client_id>
&client_secret=<client_secret>


Yields an empty body 500 internal Server Error response with the following headers

x-amzn-ErrorType: InternalFailure:http://internal.amazon.com/coral/com.amazon.coral.service/ 
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.