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

added refresh method from gotrue #237

Merged
merged 2 commits into from
May 4, 2020
Merged

Conversation

futuregerald
Copy link
Contributor

@futuregerald futuregerald commented May 1, 2020

This fixes #233 by adding a .refresh() method to netlify-identity-widget that is the equivalent of running netlifyIdentity.gotrue.currentUser().jwt() . This PR also includes an update to the README.

image

cc @jlengstorf

@futuregerald futuregerald added the type: feature code contributing to the implementation of a feature and/or user facing functionality label May 1, 2020
@netlify
Copy link

netlify bot commented May 1, 2020

Deploy Success!

Built with commit 2a0a7ba

https://deploy-preview-237--identity.netlify.app

@futuregerald futuregerald requested a review from erquhart May 1, 2020 18:31
@futuregerald futuregerald requested a review from erezrokah May 4, 2020 14:06
Copy link
Contributor

@erezrokah erezrokah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@futuregerald futuregerald merged commit 5478207 into master May 4, 2020
@futuregerald futuregerald deleted the feat/add-jwt-refresh branch May 4, 2020 14:59
@smeijer
Copy link

smeijer commented Sep 7, 2020

I expected netlifyIdentity.refresh() to refresh the data that lives on netlifyIdentity.currentUser() as well. But this doesn't seem to be happening.

Is there another way to get the new "roles" that are assigned to a user?

@ercgrat
Copy link

ercgrat commented Oct 15, 2020

I expected netlifyIdentity.refresh() to refresh the data that lives on netlifyIdentity.currentUser() as well. But this doesn't seem to be happening.

Is there another way to get the new "roles" that are assigned to a user?

I also expected this behavior - I'm keeping separate state for the token rather than relying on user.token.

@futuregerald What is the expected scenario where store.gotrue is unset? If I understand correctly, the observers will instantiate gotrue if you try and access that property. I'm asking because I'm trying to write the TypeScript definition and if I'm not logged in, calling refresh crashes rather than launching the login modal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature code contributing to the implementation of a feature and/or user facing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature request: utilize refresh tokens
4 participants