I got an access token and a refresh token for the first time, but I cannot get a new access token from the refresh token.
def refresh_token(refresh_token):
basic_auth = base64.urlsafe_b64encode(
f"{client_id}:{client_secret}".encode("utf-8")
).decode()
headers = {
"Authorization": f"Basic {basic_auth}",
"Content-Type": "application/x-www-form-urlencoded",
}
payload = {
"grant_type": "refresh_token",
"code": refresh_token,
}
response = requests.post(
"https://login.eveonline.com/v2/oauth/token", headers=headers, data=payload
)
response.raise_for_status()
return response.json()
OUTPUT:
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://login.eveonline.com/v2/oauth/token
def refresh_token(refresh_token):
basic_auth = base64.urlsafe_b64encode(
f"{client_id}:{client_secret}".encode("utf-8")
).decode()
headers = {
"Authorization": f"Basic {basic_auth}",
"Content-Type": "application/x-www-form-urlencoded",
}
payload = {
"grant_type": "refresh_token",
"refresh_token": refresh_token,
}
response = requests.post(
"https://login.eveonline.com/v2/oauth/token", headers=headers, data=payload
)
response.raise_for_status()
return response.json()
payload = {
"grant_type": "refresh_token",
"refresh_token": token.refresh_token,
"client_id": self.client_id,
"client_secret": self.client_secret,
}
try:
response = requests.post(self.token_endpoint, data=payload)
1 Like