inProgress-team / inProgress-team/react-native-meteor
Resume token not set for third party auth providers
- Dominant language
- JavaScript
- Stars
- 688
- Forks
- 200
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
in our app, we have classic password accounts as well as Facebook and Twitter accounts. For that we implemented our own login handlers for the oAuth process.
We discovered an issue with react-native-meteor, that with Facebook and Twitter login handlers the resume token is not written to the async store. This caused some issues with Meteor.userId() returning null after changes to the connection. So we added the key to the async store on our own. The code for this looks something like this:
```
export const authFacebook = (error, result) => {
return (dispatch) => {
if (error) {
// Error handling
} else if (result.cancelled) {
// Error handling
} else {
const Data = Meteor.getData()
AccessToken.getCurrentAccessToken()
.then((res) => {
if (res) {
Meteor.call('login', { facebook: res }, (err, result) => {
if (!err) {
AsyncStorage.setItem(USER_TOKEN_KEY, result.token, (err) => {
if (err) console.log('token write error: ', err)
});
Data._tokenIdSaved = result.token
Meteor._userIdSaved = result.id
dispatch(authSetUserId())
dispatch(authSuccess())
} else {
LoginManager.logOut()
// Error handling
}
})
}
})
}
}
}
```
This works fine and userId is set.
However we have some very rare cases now, in which the userId got lost later in the process. We don't know the exact circumstances when this happens, but after some time in the app (and probably some connection changes) the userId is null again. Is there any scenario where the the userId is cleared by react-native-meteor? Is there any way we could work around this? Is there a fix?
Thank you!
Georg
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.