Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OAuth_verifier is absent #467

Closed
SwapnaThorve opened this issue Feb 25, 2014 · 1 comment
Closed

OAuth_verifier is absent #467

SwapnaThorve opened this issue Feb 25, 2014 · 1 comment

Comments

@SwapnaThorve
Copy link

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 ------

Create OAuth Service Object...

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.

@kullfar
Copy link
Member

kullfar commented Mar 11, 2016

Seems, it's not actual. Google Api is 2.0 now and there is no oauth_verifier anymore ;-)

@kullfar kullfar closed this as completed Mar 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants