hupili / snsapi

Cross platform middleware for Social Networking Services: Twitter, Facebook, SinaWeibo, Renren, RSS, Email, Sqlite, ... (more coming)
http://snsapi.ie.cuhk.edu.hk
160 stars 53 forks source link

Auth Flow Review #92

Open hupili opened 11 years ago

hupili commented 11 years ago

SAP

Here's the most complete flow

auth()*
  get_saved_token()
  auth_first()*
    request_url()+
  auth_second()*
    fetch_code()+
    get_access_token()+
  save_token()

The markers:

Remarks:

Following are some use cases:

code-style OAuth via browser + local HTTPD

auth_info:{
"cmd_request_url": "(local_webserver)+(webbrowser)",
"cmd_fetch_code": "(local_webserver)",
"cmd_get_access_token": "(direct)"
}

When see (direct), the plugin supplied _get_access_token is called. In SNSBase, this is defaulted to _oauth2_get_access_token.

token-style OAuth via browser + local HTTPD

auth_info:{
"cmd_request_url": "(local_webserver)+(webbrowser)",
"cmd_fetch_code": "(dummy)",
"cmd_get_access_token": "(local_webserver)"
}

input access_token directly

auth_info:{
"cmd_request_url": "(dummy)",
"cmd_fetch_code": "(dummy)",
"cmd_get_access_token": "(console_input)"
}

e.g. sometimes, you already get the access_token somehow....

TODO