401 error generating token in some rare cases


I need help, I am frustrated T.T

im getting a token for auth from [POST] https://id.twitch.tv/oauth2/token?client_id=XXX&client_secret=XXX&code=XXX&grant_type=authorization_code&redirect_uri=XXX and it works but in some cases (2 or 3 in 100 calls) the API catch 401 error, and I don’t know why it happens

Someone could help me?

Whats the message you get with your 401?

You need to return the body/response as well as just the HTTP code.

The common issue here is that for some reason the code gets double used.