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!