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:
- 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.
- 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:
for web application, oauth token preserved on server, , rest apis called server side. calls can made synchronously, task queue not needed.
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.
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
Post a Comment