Skip to content

Commit

Permalink
tried URLSearchParams
Browse files Browse the repository at this point in the history
  • Loading branch information
Logan Leopold committed Jan 19, 2021
1 parent fc030bd commit f0fb485
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/FlightForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,20 +69,23 @@ class FlightForm extends Component {
client_secret: `${process.env.REACT_APP_AMADEUS_SECRET}`
});

// let random = `grant_type=client_credentials&client_id=${process.env.REACT_APP_AMADEUS_KEY}&client_secret=${process.env.REACT_APP_AMADEUS_SECRET}`
// console.log(random)
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)

axios({
method: 'POST',
url: 'https://test.api.amadeus.com/v1/security/oauth2/token/',
headers: {
"content-type":"application/x-www-form-urlencoded",
"Content-Type":"application/x-www-form-urlencoded",
},
data: postData
data: tokenForm
})
.then( function(response) {
console.log(response)
})
console.log(response.data)
}).catch( err => console.log(err))

}

Expand Down

0 comments on commit f0fb485

Please sign in to comment.