InvalidGrant Error Python OAuth Flow

Hi there!

We’ve been using the Asana API via the python client for a while now and have gotten a this error a few times but not in a reproducable way. It happens when trying to exchange a code for an access token.

The error is: (invalid_grant) The code provided has been previously deactivated.

And it’s being generated by this request to the client/API where the request we’re getting the code from is the OAuth redirect that contains it: response = Client().session.fetch_token(code=self.request.GET['code'])

Anyone else run into this?

Sorry never saw this error :confused:
@Phil_Seeman ?

Sorry, I’m afraid I haven’t run into that error. @Ross_Grambo any ideas here?

That error occurs when a code has already been used. Is there a chance you’re running this function twice? If not, the python-asana repo might have an error.

1 Like

I’ve checked that we’re not running it twice. For the vast majority of users there is no issue