php - How to implement a token based authentication? -
i have implement token based authentication.
users have username , password. use sha512 method encrypt password before inserting database. retrieving data server, making queries , other simple actions, need know asking data , if person authenticated. want use token. during registration server creates token user , saves in person table database, username , encrypted password. now, when user wants data server, can use token.
is there way in server can understand user using token, or need pass username too? how can know when token expires without adding field in person table?
i'm not sure have understand proper use of token, , have no idea on how implement it. use php implementing communications between server/database , android application.
as said, it's better provide username , token each time send request backend. can know if token expired or not. let service/backend support http basic authentication requires caller set specific header contains username:password encoded using base64.
Comments
Post a Comment