javascript - Should I send user tweet from browser side or server side? -


my web application send tweets on users' behalf. after getting token through oauth process, can think of 2 ways post tweet:

  1. send token browser, , use javascript post tweet twitter (there tricks post cross-domain). when receiving response twitter, post info server. way post synchronous, browser side has post twice: once twitter , once server.
  2. when client side need send tweet. post request server, server push request task queue , return asynchronously. way need set task queue on server, , tweet not real-time.

which way best way go? pros , cons?

to answer own question after bit of investigation:

  1. for web application, oauth token preserved on server, , rest apis called server side. calls can made synchronously, task queue not needed.

  2. for native app, oauth handled within app. webview used load authenciation uri, , when redirects, access code captured in url. access code used app obtain access token.

  3. for native apps, there authentication method referred sso. switches service provider's native app, , let user grant acces there, switching app. more convenient user, native client in logged-in state, saving user typing in username , password. however, approach cannot used web applications.

hope helps someone. correct me if wrong.


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -