Closed zanesterling closed 10 years ago
I thought users didn't have ids, they're just identified by username.
I think our official name for it is an OAuth Token. Google and Facebook refer to it as an id, so that's what I was thinking of at the time.
OAuth tokens probably aren't unique if we're getting them from multiple sites (Google, Facebook). It should be unique to the site, but if we have two users who register though Google and Facebook respectively, and are assigned the token with the same value, we're gonna have a bad time.
This is why I appended the letter to the start. So a Google OAuth token looks like g12524376542375 and a facebook token looks like f125143626.
On Sun, Jan 12, 2014 at 9:51 PM, Josh Hofing notifications@github.comwrote:
OAuth tokens probably aren't unique if we're getting them from multiple sites (Google, Facebook). It should be unique to the site, but if we have two users who register though Google and Facebook respectively, and are assigned the token with the same value, we're gonna have a bad time.
— Reply to this email directly or view it on GitHubhttps://github.com/stuycs-softdev/proj3-7-bookmarx/issues/3#issuecomment-32142659 .
This was the wrong way to do things, good thing we didn't.
I need two functions: authUser and addUser. authUser takes a user's id (a string of digits prefaced by a letter) and returns "returning-user" if the user has already registered, and "new-user" if the user has not registered before. addUser takes the id and username of a user to be registered and adds them to the database. It should also set up whatever defaults a new user is supposed to have.