javascript - Confusion in using OAuth in reactjs and react-native app -
i have question, let's have website (reactjs) , app (react-native) both using oauth facebook login. should save access token provided facebook in database , if should, happen access token when user logins facebook on website , login again app?
does mean access token going overwritten new login? have other suggestions practice oauth integration?
the oauth token of 2 consecutive logins different. still store them in database not 1:1 relationship user bot 1:n. means every user can have multiple oauth tokens assigned.
in oauth expiration of token. can store 1 , clean table if needed.
for mongodb again directly in answer better readability: can design user collection this:
{ "_id": 42, "username": "jeger", "token": [ {"value": "abc1234", "expiration": ...} {"value": "bca4321", "expiration": ...} ] }
and search user after token verification facebook with
collection.find({"token.value": "abc1234"})
Comments
Post a Comment