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

Token refresh flow #191

Open
tekatool opened this issue Aug 11, 2015 · 8 comments
Open

Token refresh flow #191

tekatool opened this issue Aug 11, 2015 · 8 comments

Comments

@tekatool
Copy link

I may not have an understanding of the Token Refresh flow in this library but it seems like when using NXOAuth2Request performMethod:@"GET" method, my original request to the protected resource is getting lost when the access token is expired. It gets replaced with the token refresh! Does the developer need to take that into account in his code ?
Also, when using NXOAuth2Request signedURLRequest method, it never refreshes the expired access token! Am I missing something ?

Any prompt help is appreciated.

Thanks

@toto
Copy link
Contributor

toto commented Aug 23, 2015

  • If you are using -[NXOAuth2Request performMethod:] the request should not get lost but retried automatically if the refresh success.
  • Using signedURLRequest does not do this. Here you need to hand refresh yourself. We should probably be adding a API to force refresh in these cases since it came up a few times already.

@rhythmnewt
Copy link

Is there any code example of the token refresh flow in this library?

@toto
Copy link
Contributor

toto commented Sep 14, 2015

@dimkanewtown There is currently no option for explicit refresh. Refresh should happen automatically if you use NXAuth2Request and the token is expired.

@rhythmnewt
Copy link

Thank you.

@rhythmnewt
Copy link

There's a public method called refreshAccessToken. Can I use that to force the token refresh?

@tekatool
Copy link
Author

When the Access Token is expired and I am using the [NXAuth2Request performMethod], it refreshes the token but posts the notification of the 'refresh request' and Not the Original request! Do I have to invoke the original request again ?

@chrisfoulds
Copy link

I need to use signedURLRequest , so how do I refresh the token ?
I can easily check the date to see if it's expired but what do I call to refresh ?

@shashank109
Copy link

Hi there,
I am resource owner flow and I am getting token , refreshtoken and expirytime after authentication. I save the accessToken locally for using it to api hit. While making api hit, I am using this method -

[NXOAuth2Request performMethod:@"GET"
onResource:[NSURL URLWithString:@"https://...your service URL..."] // passing api URL
usingParameters:nil
withAccount:anAccount // passing acc object here
sendProgressHandler:^(unsigned long long bytesSend, unsigned long long bytesTotal) { // e.g., update a progress indicator }
responseHandler:^(NSURLResponse *response, NSData *responseData, NSError *error){
// Process the response
// Here I am passing my api request
// Passing my accessToken locally saved
}];

but still I am getting 401 after token expired. I don't know where I am missing the things. If somebody can help, I would be really thankful.

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

5 participants