authentication - Phonegap & Jquery mobile app to use Codeigniter Ion Auth backend for login -
i have crud web application build using codeigniter php framework , ion auth authentication library (for codeigniter). users needs log-in utilize site etc.
now im building little mobile app using phonegap & jquery mobile uses same backend. there "rest like" api in backend handles ajax requests mobile client.
how should handle user authentication mobile app? want utilize much possible existing backend codebase.
im planning this:
from client send username & pass server return session id client server store session id client (local store) send token in each requests server , validate in serverside.how in backend side? login, can utilize codeigniter ion auth library login methods , codeigniter (php) session id. in sec request when user send actual info sessoin id, how validate session id? or improve thought build new login functionality mobile app authentication seek utilize existing functionality (codeignitre ion auth library)?
all ideas , suggestions more welcome!
i think best solution set middleware between controllers , request.
you can hooks : http://ellislab.com/codeigniter/user-guide/general/hooks.html
use pre controller hook.
for managing api requests, play http code
404 : not found item (like /client/:id) 500 : server has problem 401 : there no token 403 : token not authorized access resource (like simple user wants access admin stuffs)you have codes here : http://en.wikipedia.org/wiki/list_of_http_status_codes
avoid utilize complex library when can easier. hooks best me.
i utilize nodejs , concept same express middlewares.
codeigniter authentication cordova jquery-mobile ion-auth
No comments:
Post a Comment