Authorization code is invalid or expired error
When I try to convert my access code to an access token I'm getting the error: Status 400. Authorization code is invalid or expired Error: invalid_grant
Â
I formerly had this working, but moved code to my local dev machine. The steps I tried taking:
Â
1)Â Delete existing auth token/refresh token file
2) CalledÂ
https://api.cc.email/v3/idfed?client_id=<redacted>&redirect_uri=https%3A%2F%2Flocalhost&response_type=code&scope=account_read+account_update+contact_data3) When this returned a page on my browser, I logged in. I then took the auth code from the redirect url (?code=xxxxxxxxxxxxxx)
4) I called the following code, setting the authCode to xxxxxxxxxxxxxx from the step above
String tokenFromAuthCodeUrl = "https://idfed.constantcontact.com/as/token.oauth2?code=" + authCode +
"&redirect_uri=https://localhost&grant_type=authorization_code";
HttpRequest httpRequest = null;
java.net.http.HttpResponse< String > response = null;
HttpClient httpClient = HttpClient.newBuilder().build();
httpRequest = HttpRequest.newBuilder()
.uri( URI.create( tokenFromAuthCodeUrl ) )
.header( "Authorization" , refreshTokenHeadersMap.get( "Authorization" ) )
.POST( HttpRequest.BodyPublishers.ofString( "" ) )
.build();
response = httpClient.send( httpRequest , java.net.http.HttpResponse.BodyHandlers.ofString() );
5) The response returned is Status 400. Authorization code is invalid or expired Error: invalid_grant
Â
I'm not sure where to go from here. Can anyone see a problem with what I'm doing?
Â
Popular Posts:
Small Business Holiday Outlook 2025: Make-or-Break Season! 🚨
💬 What’s Your Secret Sauce for Subject Line Success?
New Update: Edit Custom Fields Directly in Your Sign-Up Form! 🎉