invalidate the old one) each time a new access_token is requested (using the refresh_token).
Attached is a working bit of code to reproduce my problem (boxtest.go).
1. Sign up for a free box account
4. Click the "BoxLogin" and authenticate (getting the initial access and refresh tokens)
5. Fetch Folder 0 to confirm it's working
6. Click "ExpireToken"
7. Fetch Folder 0 - it works this time because the client refreshes the token - but I can't figure out how to preserve it for later use
I'd like my "StoreToken" method to get called here to grab a copy of the new refresh_token
8. Fetch Folder 0 - it bombs here because I'm still using the original access and refresh tokens which are now both invalid.
> Error returned by box:
> get files faled with 'Get https://api.box.com/2.0/folders/0: oauth2: cannot fetch token: 400 Bad Request
> Response: {"error":"invalid_grant","error_description":"Refresh token has expired"}'
So, I'd appreciate any advice on how to do this better. This is so far my best understanding as to how this should be
accomplished but I'm a bit new to go so if there is a better approach please advise!
--
Thanks,
John Hare