I have been implementing the Google web server OAuth flow, but when I attempted to exchange the authorization code with access token, it always complains \"invalid_code\".
I was using http://localhost:8080 as my redirect url since I was just trying out their examples. And my json file contents had this:
"redirect_uris": [
"http://localhost:8080"
],
"javascript_origins": [
"http://localhost:8080"
]
In the developer console I had the redirect_uri set to "http://localhost:8080" and I was getting the same error. I changed it to "http://localhost:8080/" and then it started working. (Essentially adding a '/' at the end.)
Hope this helps!
The life span of authorization code is only 10 mins,and can only be used one time. So do these checks: