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

Way to retry request after refreshing token with new 4.0.0 token refresh feature? #64

Open
Liam-OShea opened this issue Nov 2, 2020 · 1 comment

Comments

@Liam-OShea
Copy link

Sorry for all the issues! I am enjoying using your app.

I noticed when playing with the new token refresh feature in 4.0.0 that when the token is expired, a new token is requested from Yahoo and supplied to the callback function, but the original request to the API is not remade with the new token.

Is there a way configure it so that the original request is remade upon a successful refresh of the access token?

@whatadewitt
Copy link
Owner

Hey @LudicrousLiam, sorry I'm not getting any emails from Github.

I had this built in and then removed it because of issues where users might not specify some of the stuff needed...

If you look at the old fantasy sandbox / docs source code that I had before I built the new version using Next, I have this workflow outlined here: https://github.com/whatadewitt/yahoofantasysandbox/blob/master/routes/index.js#L63

This is a bit convoluted as this lives inside of a catchall route so it can execute any request -- but I think it's what you're looking for.

Basically, I'm using a callback function and you can see on line 70 that if it errors I am refreshing the token and then re-submitting the request. This same workflow MIGHT actually live somewhere in the history of the new sandbox / docs site https://github.com/whatadewitt/fantasy-docs-next/blob/master/pages/api/yahoo/%5B%5B...slug%5D%5D.js as well, but I don't have time to search through it right now.

Again, sorry for the delayed response! Hope I am not too late!

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