2 followers Follow

Temporary storage of token

I am creating a plugin to access a internal service using api. I am able to get user name and password from the user and pass it to the api to get a short lived (15min) access token from the api service. I want to know how best to store this api token in geneious so that user doesn't have to reentry the username and password each time.
Jagannathan Alagurajan

Official comment


if you use the 'PasswordOption' you can specify whether to remember the password or not, so user wouldn't have to enter it again but you will need to re-fetch the token.

If you want to re-use the access token, one way to achieve that would be to add another 'PasswordOption', set it's visibility to false and store the token value in that option.

All options serialize their values by default to user_preferences.xml. You could use any other String option as well, but using the PasswordOption will encrypt the token before serializing it.

Jonas Kuhn
Comment actions Permalink

Please sign in to leave a comment.

1 comment