i'm trying to exchange a received authorization code wth a token in a web application but when I call GoogleAuthorizationCodeTokenRequest i get this error : "Invalid parameter value for redirect_uri: Invalid scheme:https://mapmydayunamur.appspot.com/getauthcodeservlet"
I've tried many redirect_uri and don't know why I get this error. The Uri is in my redirect Uri in developers console. Here's my code : in getauthcodeservlet.java :
String authcode = req.getParameter("code");
String clientID = "CLIENTID_FROM_GOOGLEDEVELOPERSCONSOLE"
String clientSecret = "CLIENTSECRET_FROM_GOOGLEDEVELOPERSCONSOLE";
String redirectUri = "https://mapmydayunamur.appspot.com/getauthcodeservlet";
try {
GoogleTokenResponse response =
new GoogleAuthorizationCodeTokenRequest(new NetHttpTransport(), new JacksonFactory(),clientID, clientSecret, authcode,redirectUri).execute();
resp.getWriter().println("Access token: " + response.getAccessToken());
} catch (TokenResponseException e) {
if (e.getDetails() != null) {
resp.getWriter().println("Error: " + e.getDetails().getError());
if (e.getDetails().getErrorDescription() != null) {
resp.getWriter().println(e.getDetails().getErrorDescription());
}
if (e.getDetails().getErrorUri() != null) {
resp.getWriter().println(e.getDetails().getErrorUri());
}
} else {
resp.getWriter().println(e.getMessage());
}
}
}
Thanks for helping me