How to obtain refresh token in OAuth 2.0?

Go To StackoverFlow.com

2

I am writing a Chrome extension which needs to access minus.com by OAuth 2.0. I have key and secret, but not refresh token, so every time I make a XMLHttpRequest, in which the refresh token is undefined, the server responses a 400 error with response text saying "No such refresh token: undefined". So could anyone tell me how to obtain the refresh token?

Thanks!

2012-04-05 00:38
by chaohuang


1

The refresh_token should be passed back in the response structure during the token fetch using user permissions step, as denoted here: http://miners.github.com/MinusAPIv2/v2/auth_tutorial.html#getting-tokens-using-user-credentials

You'll be making the request for the token with the user credentials and then get back a response structure that looks something like this:

{
    "access_token": "dc19a1ea88",
    "token_type": "bearer",
    "expires_in": 3600,
    "refresh_token": "20ad15128b",
    "scope": "read_public"
}

If you extract the refresh token and then use it in the refresh step here: http://miners.github.com/MinusAPIv2/v2/auth_tutorial.html#refreshing-an-access-token that should work.

2012-04-05 01:34
by Jonathan LeBlanc
Ads