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

Improve token refresh and add token login method #51

Merged
merged 2 commits into from
Mar 2, 2022
Merged

Improve token refresh and add token login method #51

merged 2 commits into from
Mar 2, 2022

Conversation

D34DPlayer
Copy link
Contributor

#22 fixes the token refreshing not working at all, but it still uses the stored username and password to work. This PR stores the refreshToken on the first login and uses it on the api/auth/token route to login without credentials.

Also, refreshToken expires 7 days after being issued, and gets refreshed with the actual token, so there's no way it'll expire in between refreshes.

Besides that I also added a token_login method to reuse an user provided token/refreshToken. I'm creating an app that performs actions on TB as the app user and this would allow me to only use their tokens instead of storing their credentials.

- Rename `self.token_info.refreshToken` to `exp`
- Stop storing the username/password
- Store the `refreshToken` from the login request
@imbeacon imbeacon merged commit d105c10 into thingsboard:master Mar 2, 2022
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

Successfully merging this pull request may close these issues.

None yet

2 participants