I’m migrating my application from v2 to v3, I set a sandbox application to test my changes and I’m getting this error when calling the exchange_code_for_token
method in the Python SDK, my code looks like this:
code_exchange_request = CodeExchangeRequest(
code=code,
redirect_uri=redirect_uri,
client_id=settings.NYLAS_CLIENT_ID,
client_secret=settings.NYLAS_CLIENT_SECRET,
)
try:
token: CodeExchangeResponse = self.client.auth.exchange_code_for_token(code_exchange_request)
except NylasOAuthError as e:
log.logger.error(f"[NYLAS] Error {e.error_code} {e.error_description}.")
raise e
The output in the logs looks like this: ERROR [NYLAS] Error 25022 Invalid credentials provided.
I tried using my client_id and client_secret in the Nylas web API client from here and I got the same error:
{
"error": "invalid_request_error",
"error_code": 401,
"error_description": "request is empty or malformed",
"error_uri": "https://accounts.nylas.io/#tag/Event-Codes",
"request_id": "e774609a-eb1a-44d3-abe7-faf04254c6c8"
}
What could I be doing wrong?