php - How should I create my API for mobile applications (Needs Authentication) -


background

so i've been researching quite bit past week api's , have been reading concepts , programming one.

currently have website programmed in php using popular framework called laravel. website has user database , users able log dashboard on website, works want website side.

now next project of business i'm focusing on creating mobile applications (ios & andriod).what need these mobile applications being able login through application ui (not being redirected site callback url) able view , manage dashboard.

the method of authentication , authorization want use application go like

  • client asks user login through ui
  • user enters credentials
  • client sends request login api
  • the api checks if credentials correct
  • api creates token stored in token database linked user id
  • api returns 200 ok json response or this

{ "token" : "ols25usjiay81hdy81", "expiry" : 3/06/2016 14:00}

  • client remembers token , expiry
  • whenever user/client makes request such api/v1/mystuff/orders sends token request(probably through http headers?)
  • api verifies token, gets user id , finds users orders

questions

i know 1 hell question , i'm not asking people program entire software haha need know is

  • what should use create api (needs php, , preferably laravel integrated)
  • what resources me program api
  • is there suggestions/changes you'd recommend?

requirements

  • username/password authentication
  • token authorization
  • login through app ui (not on website callback)

notes

  • my website has ssl cert.

laravel choice create api , plan authentication , authorization pretty solid.

i recommend use json token authentication package laravel https://github.com/tymondesigns/jwt-auth

you can see tutorials here:

https://scotch.io/tutorials/token-based-authentication-for-angularjs-and-laravel-apps

https://www.sitepoint.com/how-to-build-an-api-only-jwt-powered-laravel-app/

i recommend api package https://github.com/dingo/api save lot of work.

if need watch series https://laracasts.com/series/incremental-api-development laracast, requires subscription, it's more worth it.


Popular posts from this blog

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo