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

Refresh access token automatically #44

Open
hegedus90 opened this issue Apr 15, 2020 · 1 comment
Open

Refresh access token automatically #44

hegedus90 opened this issue Apr 15, 2020 · 1 comment

Comments

@hegedus90
Copy link
Contributor

Is it possible to refresh the access token automatically? Something like:

  • I call an endpoint and it returns with 401 Unauthorized because my access token is expired
  • The TraktManager recognises this and calls getAccessTokenFromRefreshToken and waits for the response
  • if it's a success, the manager repeats the original request and calls the completion block with the new response, otherwise, it calls the completion block with the original error.

I wonder if it's possible to insert such logic into your library's mutableRequest methods because I'm not fully aware of the architecture of the project. Let me know your thoughts!

As I've already contributed to your project, I'm keen to make a PR based on our discussion here.

Thank you,

Attila (author of MoviX app)

@MaxHasADHD
Copy link
Owner

Hi there! I think that sounds like a good idea. Putting it in a place that happens automatically for all API calls sounds great too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants