android - Handling User Auth (via Facebook) and secure communication within an app -
maybe following sound somehow wierd , have false assumptions hope can condone on this.
just brief introduction want achieve:
right developing app needs backend storing user specific data (eg images, comments, etc). want rid off user authentication , want use facebook functions, too, let facebook authentication stuff , create user based on id/email receive after have authenticated.
let's brief describe flow:
- user opens app , not logged in (the facbook sdk handle session , persisting cookie on own).
- user authenticates via facebook.
- app sends id server. server return if there id existing , therefor app show kind of registration (domain specific form) or login user immediately
and comes tricky part not sure how handle this.
as api of backend public (https) need somehow assure if user logged in before able data via app.
it not enough "oh, app has validated user, noone else call backend". how can backend verify api-consument authenticated facebook login? want avoid can call our rest service facebook id has persisted on device.
keep in mind: not want assign password user when authenticated facebook.
maybe have kind of wierd thinking in use case, enlight me! answers , shared knowledge in advance. looking forward!!
if make server fetch user info using access token can this:
- do client side oauth authentication , receive access token
- send access token backend , user info including facebook id facebook api using token
- the server store hashed id (
cookie = id + ":" + hash(id + secret)) in http cookie - do registration/login thing
- on each request backend of server validate id cookie recomputing hash secret , comparing value cookie
Comments
Post a Comment