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

Expired OAuth details being restored by getStoredCredentials() #13

Open
FishOfPrey opened this Issue Mar 20, 2018 · 3 comments

Comments

Projects
None yet
3 participants
@FishOfPrey

FishOfPrey commented Mar 20, 2018

I tried to restart my Fridge project after a couple of weeks of inactivity to do some modifications.
The Agent code started failing with the error message:

ERROR: [ { "message": "Session expired or invalid", "errorCode": "INVALID_SESSION_ID" } ]

I logged the access_token, and it was indeed expired. From my reading of getStoredCredentials() and getOAuthToken(...) the oAuth details are persisted as a Squirrel table. This seems problematic, as the access_token expires and needs to be updated using a refresh token periodically.

I initially tried adding a server.save({}); immediately after the server.error on line 204. However, that didn't restart to OAuth process to get a valid access_token.

Seems I also needed to browse to the Agent URL to complete the OAuth steps again.

Failing using the refresh_token, is there a way to clear out the existing expired OAuth details and indicate that the agent URL needs to be browsed to?

@PadmanPL

This comment has been minimized.

PadmanPL commented Oct 3, 2018

Have you had your issue solved? I am facing the same problem

@ppetrosh ppetrosh self-assigned this Oct 8, 2018

@ppetrosh

This comment has been minimized.

Contributor

ppetrosh commented Oct 11, 2018

I am looking into this. I will update the ticket with the results of my investigation and the suggestions.

@ppetrosh

This comment has been minimized.

Contributor

ppetrosh commented Oct 16, 2018

What I found is that refresh token has never been used in the library/examples. So I added update of access token into the smart refrig example. I haven't fully tested it yet, but you should get the idea.

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