You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using scribe-java for implementing Google Authentication. I could successfully implement it for Facebook. Following is the code. I am facing issues in retrieving the oauth_verifier.
System.out.println(">> Create OAuth Service Object...");
gsService = new ServiceBuilder()
.provider(GoogleApi.class)
.apiKey(ParameterDetails.GP_API_KEY) // client Id
.apiSecret(ParameterDetails.GP_API_SECRET) // client secret
.callback("http://localhost:8888/ScribeOauth/ResponsePage.jsp")
.scope("https://docs.google.com/feeds/")
.build();
// Place the verifier
System.out.println(">>> Extracting verifier");
System.out.println(request.getParameter("oauth_token"));
System.out.println(request.getParameter("oauth_verifier"));
System.out.println(request.getAuthType()+"\n"+request.getQueryString()+"\n"+request.getPathInfo());
Verifier gsv = new Verifier(request.getParameter("oauth_verifier"));
System.out.println("\tVerifier: "+gsv);
Getting request token...
Request Token: Token[4/dUrlAAzzWBlC5X4mO6eIw0l3J0Zy , i41lEDgS2UZQ_zXUgFlCK-qj]
Authorization url...
URL: https://www.google.com/accounts/OAuthAuthorizeToken?oauth_token=4/dUrlAAzzWBlC5X4mO6eIw0l3J0Zy
Extracting verifier
null
null
null
null
null
Feb 25, 2014 2:10:28 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [openIdLogin] in context with path [/ScribeOauth] threw exception
java.lang.IllegalArgumentException: Must provide a valid string as verifier
at org.scribe.utils.Preconditions.check(Preconditions.java:82)
at org.scribe.utils.Preconditions.checkNotNull(Preconditions.java:29)
at org.scribe.model.Verifier.(Verifier.java:22)
I cant proceed ahead because the oauth_verifier is not there in the Url.
I tried assigning null value, or giving a particular sequence. I also tried using get Query parameter methods on the URI, still it gives null. Also I thought I l redirect the user to the Auth url so that I get that parameter, but it still didnt work. (I had redirected the user to the AuthUrl while implementing for facebook). Also are the parameters passed while building the serviceBuilder object correct?
I am running the project as a Dynamic Web Project on a localhost.
Can anyone please help? I have no idea how do I proceed.
The text was updated successfully, but these errors were encountered:
I am using scribe-java for implementing Google Authentication. I could successfully implement it for Facebook. Following is the code. I am facing issues in retrieving the oauth_verifier.
System.out.println(">> Create OAuth Service Object...");
gsService = new ServiceBuilder()
.provider(GoogleApi.class)
.apiKey(ParameterDetails.GP_API_KEY) // client Id
.apiSecret(ParameterDetails.GP_API_SECRET) // client secret
.callback("http://localhost:8888/ScribeOauth/ResponsePage.jsp")
.scope("https://docs.google.com/feeds/")
.build();
// Get request token
System.out.println(">>> Getting request token...");
Token gReqToken = gsService.getRequestToken();
System.out.println("\tRequest Token: "+gReqToken);
// Authorization URL
System.out.println(">>> Authorization url...");
String gsAuthUrl = gsService.getAuthorizationUrl(gReqToken);
System.out.println("\tURL: "+gsAuthUrl);
// Place the verifier
System.out.println(">>> Extracting verifier");
System.out.println(request.getParameter("oauth_token"));
System.out.println(request.getParameter("oauth_verifier"));
System.out.println(request.getAuthType()+"\n"+request.getQueryString()+"\n"+request.getPathInfo());
Verifier gsv = new Verifier(request.getParameter("oauth_verifier"));
System.out.println("\tVerifier: "+gsv);
// Get access token
System.out.println(">>> Getting access token...");
Token gAccToken = gsService.getAccessToken(gReqToken, gsv);
System.out.println("\tAccess Token: "+gAccToken.getToken());
------ Following is output ------
I cant proceed ahead because the oauth_verifier is not there in the Url.
I tried assigning null value, or giving a particular sequence. I also tried using get Query parameter methods on the URI, still it gives null. Also I thought I l redirect the user to the Auth url so that I get that parameter, but it still didnt work. (I had redirected the user to the AuthUrl while implementing for facebook). Also are the parameters passed while building the serviceBuilder object correct?
I am running the project as a Dynamic Web Project on a localhost.
Can anyone please help? I have no idea how do I proceed.
The text was updated successfully, but these errors were encountered: