The code is already used is a common problem here. As the
code is a one use code to be exchanged for a token
code should be dynamically obtained from the URL as it’s a query strin parameter and not hard coded.
that was the response from oauth2/authorize
I used the code from response
both options are not possible.
I try to get the access-token immediately
Then this suggests a fault in
Would need to see what that function is doing.
Broadly looks correct.
Heres a simplier fetch example to reference
I tried it with your method and it worked.