shohey1226 / Thnkout

0 stars 0 forks source link

Handling login with twitter signin #9

Closed shohey1226 closed 10 years ago

shohey1226 commented 10 years ago
  1. User click login link(/oauth/twitter)
  2. Redirect to twitter and choose yes or no
  3. coming back to backend server with info
  4. Store these info to database(query to twitter to obtain face_pic or maybe others) -- here, the info is in session. using the info.

/api/v1/login-info

Query from page and obtain,

1 The user is logged in or not via session

  1. If logged in, get user's info (key, others)
  2. and display logged in with picture. (or can be redirect to my-view page)

I think we should refresh user_name and user face pic every time user sign in.

shohey1226 commented 10 years ago

Flow for the Login

  1. Client GET /api/v1/login-info
  2. Server check session and return information in the session if available.

    // if available {logged_in => 1, id => 1, image_url => 'http://...', screen_name => 'kamepaca' } // if not available {logged_in => 0 }

  3. Client displays ログイン or ログアウト using $RouterProvider and $ng-switch
shohey1226 commented 10 years ago

Flow for the Login (handling database)

  1. Client clicks ログイン button/link
  2. Server query with Net::Twitter::lite to Twitter to obtain image_url and others.
  3. Check the info which returns from Twitter
  4. If the user is in the database, compare the contents from Twitter with the data in the database. If different, update with twitter's info
  5. If the user is not in the database, insert the info to the database 6.Add these info to session
shohey1226 commented 10 years ago

This is completed. after login, it moves to '/'