alexziskind1 / nativescript-oauth2

Other
85 stars 93 forks source link

What am I missing? (Vue storing access token) #137

Closed BrianPainter closed 3 years ago

BrianPainter commented 3 years ago

I'm attempting to save the tokenResult to Vuex so that I can utilize it later throughout my app. Currently I cannot figure out how to do anything with the tokenResult that is available in the completion function. I can see the access token when it's printed to the console, but I can't seem to store it in the Vuex store, or otherwise make use of it outside of the class. I think I must be missing something simple, but I've reviewed the documentation multiple times as well as the example app. Anyone out there have a helpful next step?

keithgulbro commented 3 years ago

@BrianPainter Did you figure this out? If not, I can help you as I've built a complete application with oAuth2 & persistent authentication with the access token & refresh token.

alexziskind1 commented 3 years ago

Hey @BrianPainter . I recommend not storing this is Vuex as it is a token that you may want to use even after application memory has been purged (in the event of an app restart for example). Store the token in NativeScript's application-settings module. Or depending on your security requirements, you could store it using the secure-storage plugin, which, although not unbreakable is a bit more secure than application-settings. It will add another dependency though so don't add the plug-in lightly. Cheers.