Replies: 5 comments
|
Not sure what you mean with ‘there is nothing to do’. The isLoggedIn function that is being exported checks if the refresh tokens are present. If they are, that means that the user is authenticated (given that the tokens are valid) |
|
I can get the stored token but that function can not set isLoggedIn as true. |
|
When you store tokens using
I hope this helps. |
|
`import React, { useState } from 'react'; import { const App = () => { const refreshToken = getRefreshToken().then(refreshToken => console.log(refreshToken)) if(!isLoggedIn() ) { <Button title="Logout" style={styles.button} onPress={() => logout()} /> )} else { return ( <StatusBar barStyle={isDarkMode ? 'light-content' : 'dark-content'} /> <TextInput style={styles.input} placeholder="Email" placeholderTextColor="#fefefe" keyboardType="email-address" autoCapitalize="none" // value={fullName} onChangeText={onChangeNameHandler} ); const styles = StyleSheet.create({ export default App;` Can't get it to work right now. Keep "LoggedIn" alert even in first run. |
|
I'm sorry, but I can't read your code at all. Would you mind formatting your code properly and removing everything that has nothing to do with authentication? Also keep in mind that isLoggedIn returns a promise. So: or |
Uh oh!
There was an error while loading. Please reload this page.
Hi.
How to get current login state?
There's nothing to do with isLoggedIn function.
All reactions