I am new to Amadeus and am currently stuck at the first step. I am using the test URL (test.api.amadeus.com) When I use the example code with my API key and API secret, I get the following:
ClientError
Below is the backend code I used with the key and secret:
const express = require('express');
const Amadeus = require('amadeus');
const app = express();
const amadeus = new Amadeus({
clientId: '{API key}',
clientSecret: '{API secret}'
});
amadeus.shopping.flightOffersSearch.get({
originLocationCode: 'SYD',
destinationLocationCode: 'BKK',
departureDate: '2022-06-01',
adults: '2'
}).then(function(response){
console.log(response.data);
}).catch(function(responseError){
console.log(responseError.code);
});
app.use(express.static('client'));
app.listen(8080);
No issues on the express side.
I can get my access token using the curl command on the "get started" guide, however when I run the below curl command I get this error:
command:
curl -X GET 'https://test.api.amadeus.com/v1/shopping/flight-destinations?origin=PAR&maxPrice=200' -H 'Authorization: Bearer {{token}}'
response
{
"errors": [
{
"code": 38190,
"title": "Invalid access token",
"detail": "The access token provided in the Authorization header is invalid",
"status": 401
}
]
}
Any help will be appreciated. I can't seem to see where I have gone wrong