Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6638989
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T23:30:07+00:00 2026-05-25T23:30:07+00:00

I am using grails oauth plugin. Which is providing me yahoo’s access_token successfully. But

  • 0

I am using grails oauth plugin. Which is providing me yahoo’s access_token successfully. But the problem is — this token (from yahoo) has validity of 1 hr only. And after that we need to refresh it. And going through their documentation it seems like they have process to refresh it (in case token expires). And this call bypasses the thrid leg (user’s manual acceptance process). that’s very good!

Now, if I am trying to use method oauthService.fetchAccessToken — I guess this is the method which hits get_access_token url (at provider’s side). But I am getting exception:

oauth.signpost.exception.OAuthNotAuthorizedException: Authorization
failed (server replied with a 401). This can happen if the consumer
key was not correct or the signatures did not match. at
oauth.signpost.AbstractOAuthProvider.handleUnexpectedResponse(AbstractOAuthProvider.java:239)
at
oauth.signpost.AbstractOAuthProvider.retrieveToken(AbstractOAuthProvider.java:189)
at
oauth.signpost.AbstractOAuthProvider.retrieveAccessToken(AbstractOAuthProvider.java:99)
at oauth.signpost.OAuthProvider$retrieveAccessToken.call(Unknown
Source) at
org.grails.plugins.oauth.OauthService.fetchAccessToken(OauthService.groovy:286)
at
org.grails.plugins.oauth.OauthService$fetchAccessToken.call(Unknown
Source)


I have debugged further into plugin and signpost code. And I think we should look into signpost (for now), plugin can be modified easily later.

For your information, I am using signpost (jar – 1.2.1.1) with commonshttp4 client

here’s the link of Yahoo documentation page for refreshing the accessToken.
http://developer.yahoo.com/oauth/guide/oauth-refreshaccesstoken.html

Yahoo needs oauth_session_handle parameter in the request which is sent by yahoo with accessToken. Signpost does provides a way to fetch this — provider.getResponseParameters().

Now next is, I am using following way to put these parameters back into the refreshToken request —
consumer.setAdditionalParameters(httpParams)

But it doesn’t work! Following is the part of stacktrace. When I try to get the refreshedAccessToken

oauth.signpost.exception.OAuthNotAuthorizedException: Authorization
failed (server replied with a 401). This can happen if the consumer
key was not correct or the signatures did not match. at
oauth.signpost.AbstractOAuthProvider.handleUnexpectedResponse(AbstractOAuthProvider.java:239)
at
oauth.signpost.AbstractOAuthProvider.retrieveToken(AbstractOAuthProvider.java:189)
at
oauth.signpost.AbstractOAuthProvider.retrieveAccessToken(AbstractOAuthProvider.java:99)

looking forward to hear soon from some great/generous guy(s) 🙂

Thanks,
Salil

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T23:30:07+00:00Added an answer on May 25, 2026 at 11:30 pm

    I have found the answer and want to share it others (who might trap with similar situation).

    First of all, if you are using signpost library for oauth, I would recommend you to stop using it. Because, the development has been stopped since jan 2011. Read this:
    http://brainflush.wordpress.com/2011/01/27/stepping-back-from-signpost-development/

    I used ‘scribe-java’ for this. here’s the link on github. You can either use maven or download jar or just fork the code.
    https://github.com/fernandezpablo85/scribe-java/

    It’s very easy to use, even the (top) service providers URLs are configured beforehand.

    here’s the code how to refresh it using scribe-java library.

    Token accessToken = new Token('your-expired-token-key', 'your-expired-token-secret')
    println ".......................... Expired Token ........................\n $accessToken"
    
    OAuthRequest request = new OAuthRequest(Verb.GET, "https://api.login.yahoo.com/oauth/v2/get_token");
    request.addOAuthParameter('oauth_session_handle', 'your-yahoo-session-handle') // you need to fetch it from the parameters when get your access token.
    service.signRequest(accessToken, request);
    Response response = request.send();
    accessToken = YahooApi.class.newInstance().getAccessTokenExtractor().extract(response.getBody())
    
    println ".......................... Refreshed Token ........................\n $accessToken"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using Grails i'm trying a dynamic finder like this one Policy.findAllByResourceAndUser(resource,user) But When i
Hi I'm using grails navigation plugin and when it generates menus it put the
I am working on a web application (using Grails) which will generate a gift
I'm following the racetrack example from Jason Rudolph's book at InfoQ , using grails-1.2.1.
I face a problem using Grails 2 submitToRemote tag. The following code is what
I am new to using Grails plugins and this is most likely a novice
We're developing an app (using Grails Spring Security (formerly Acegi)) in which we'll have
We're using Grails but with an existing model layer and DAO layer. We have
For learning purposes I created a toy project using grails. In this project I
I'm using Grails 1.3.7 + MySQL 5.5 + Liquibase through the database-migration plugin 0.2.1.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.