I have to get the token by sending a request to a specified address. I used
$ curl $ curl -XPOST -H "Content-Type: application/json" -d '{ "client_id": "xxx", "client_secret": "11111111", "grant_type": "client_credentials", "scope": "public" }' "https://example.com/auth/token"
I got the token
abcdefg12345
Now I have to use that token to make a request to this url endpoint (which includes params as seen below):
$ curl -XGET -H "Authorization: Bearer {access_token}" "https://example.com/api/vacations/search?country=us&locale=en-US&price=affortable"
Im not too familiar with api requests but tried to research it so what I was trying to do is:
http.get("https://example.com/api/vacations/search?country=us&locale=en-US&price=affortable"+"&token=abcdefg12345")
Unfortunately that doesn't work and I get this: "access token not authorized" Could anyone help? Im also not quite sure if a Bearer token is anyhow different from a 'regular'token and the request has to be different? Also not sure if it was right to leave the params in the url endpoint or should I specify them like that:
http.get("https://example.com/api/vacations/search?"+params+"&token=abcdefg12345", {params:country='us', price:affordable})
Thanks a lot!