I have an account on the website: https://dev.yuride.network/
I am using it for testing purposes. There is a particular API that I am getting issues with
https://dev.yuride.network/api/users/me/
I am making GET request to the above URL and passing the access token like:
response = requests.get(url, headers={'accesstoken': accessToken})
The access token is obtained by making an API call to
https://dev.yuride.network/api/token/?name=xyz and passing payload data with
username
and password
this API is successfully returning the access token with JSON
{
"access":"asdsad",
"refresh":"asdasd"
}
But the request requests.get(URL, headers={'accesstoken': accessToken})
is failing
I am not sure if I am passing the header the wrong way or the key to be used should be
different than the accesstoken
that I am using
I copied the curl command from the inspect tab while going to /api/user/me from the address bar :
curl 'https://dev.yuride.network/api/users/me/' \
-H 'authority: dev.yuride.network' \
-H 'pragma: no-cache' \
-H 'cache-control: no-cache' \
-H 'sec-ch-ua: " Not A;Brand";v="99", "Chromium";v="99", "Microsoft Edge";v="99"' \
-H 'sec-ch-ua-mobile: ?0' \
-H 'sec-ch-ua-platform: "Windows"' \
-H 'upgrade-insecure-requests: 1' \
-H 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.74 Safari/537.36 Edg/99.0.1150.55' \
-H 'accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9' \
-H 'sec-fetch-site: none' \
-H 'sec-fetch-mode: navigate' \
-H 'sec-fetch-user: ?1' \
-H 'sec-fetch-dest: document' \
-H 'accept-language: en-US,en;q=0.9' \
-H 'cookie: saml_session=aayrv7sksot1ooztihpht7svi5cydcet; csrftoken=6sQYPXR7ldqU5LCuR19DkUvsRbWmyll4TamiM4DqjKQdzWTh4u3TGkvI8ZwgGYbp; sessionid=5r6v6uk5vv3aufyt82np2guxn30pa3gu' \
--compressed
The above command runs fine on bash shell. It doesn't have any access token