Skip to content

Commit

Permalink
still do not have it working
Browse files Browse the repository at this point in the history
  • Loading branch information
Logan Leopold committed Jan 19, 2021
1 parent 5a1f563 commit 7917387
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions src/FlightForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,32 +63,32 @@ class FlightForm extends Component {
outboundDate: today
})

let postData = querystring.stringify({
grant_type: "client_credentials",
client_id: `${process.env.REACT_APP_AMADEUS_KEY}`,
client_secret: `${process.env.REACT_APP_AMADEUS_SECRET}`
});
// let postData = querystring.stringify({
// grant_type: "client_credentials",
// client_id: `${process.env.REACT_APP_AMADEUS_KEY}`,
// client_secret: `${process.env.REACT_APP_AMADEUS_SECRET}`
// });

let encoded = encodeURIComponent(postData)
// let postData = {
// grant_type: "client_credentials",
// client_id: `${process.env.REACT_APP_AMADEUS_KEY}`,
// client_secret: `${process.env.REACT_APP_AMADEUS_SECRET}`
// };

console.log(postData)
console.log(encoded)
let body = `grant_type=client_credentials&client_id=${process.env.REACT_APP_AMADEUS_KEY}&client_secret=${process.env.REACT_APP_AMADEUS_SECRET}`

let tokenForm = new URLSearchParams()
tokenForm.append('grant_type', 'client_credentials')
tokenForm.append('client_id', process.env.REACT_APP_AMADEUS_KEY)
tokenForm.append('client_secret', process.env.REACT_APP_AMADEUS_SECRET)
// console.log(body)

axios({
method: 'POST',
method: 'post',
url: 'https://test.api.amadeus.com/v1/security/oauth2/token/',
headers: {
"Content-Type":"application/x-www-form-urlencoded",
},
data: `${encoded}`
data: body
})
// axios.post('https://test.api.amadeus.com/v1/security/oauth2/token/', JSON.stringify(tokenForm), {
// headers: {"Content-Type":"application/x-www-form-urlencoded"}
// axios.post('https://test.api.amadeus.com/v1/security/oauth2/token/', {body}, {
// headers: {"Content-Type":"application/x-www-form-urlencoded"},
// })
.then( function(response) {
console.log(response.data)
Expand Down

0 comments on commit 7917387

Please sign in to comment.