-
Notifications
You must be signed in to change notification settings - Fork 476
Closed
Labels
questionGeneral question about usageGeneral question about usage
Description
You want to:
I want to get token for setting up automatic login in my react native app. I have written getTokens
and setTokens
functions as shown below:
export const getTokens = (cb) => {
AsyncStorage.multiGet([
'@NBA_App@token',
'@NBA_App@refreshToken',
'@NBA_App@expireToken',
'@NBA_App@uid'
]).then(values => {
cb(values);
})
}
export const setTokens = (values, cb) => {
const dateNow = new Date();
const expiration = dateNow.getTime() + (3600* 1000)
AsyncStorage.multiSet([
['@NBA_App@token', values.token],
['@NBA_App@refreshToken', values.refToken],
['@NBA_App@expireToken', expiration.toString()],
['@NBA_App@uid', values.uid]
]).then(response => {
cb();
})
}
Details:
I am not able to get the tokens on reloading app using componentDidMount. I get the token array as 'null'.
Metadata
Metadata
Assignees
Labels
questionGeneral question about usageGeneral question about usage