php - Need to know client/user authentication solution -
i have api login client(mobile apps), want know solution if i'm using session login mobile apps.
the flow this, below:
client(mobile apps) -> login(api) -> generate token , save table token -> success (response token)
toke table this, below:
--------------------------------------------------------------------------- |id | notoken | userid | created_at | |1; | "1d2c8ad6019b2ec31af909e7ac23ca1b"; |"3"; |"2015-06-11 17:25:24" | |2; | "a1f6f81ff822a4be87b9e7c35d671ce9"; |"3"; |"2015-06-11 17:25:41" | |3; | "57c99c22d884d5c3af1674ff9327926f"; |"3"; |"2015-06-11 18:24:23" | |4; | "3c63d115ad798f2898deb838cdc2b447"; |"3"; |"2015-07-02 22:40:04" | |5; | "c5b2bf2f957fdaa97e1abb79e164f23e"; |"3"; |"2015-07-02 22:40:43" | ---------------------------------------------------------------------------
when user login through api generate token table above.
solution session login:
if user doesnt have activity more 5 hours, delete row has same token in mobile apps. create cronjob check table has no activity more 5 hours , delete row.
question:
is solution above good? or maybe there other solution?
already login -> check token has activity or not -> yes -> information
-if no-
pop screen on apps "session timeout or user has no activity"
solution user activity:
every activty client do, update table token datetime. if client has activy not delete or destroy notoken
in token table.
question:
is solution make apps activity heavy load?
cmiiw
Comments
Post a Comment