How to create tokens for custom authentication?

0 votes
Hi, I'd like to implement a custom log in for Android and I'd like to use tokens for sessions, so the user doesn't have to log in every time he runs the app. How can I do it? Thanks
asked May 10, 2016 in Announcements by Leandro Flórez Arist (11 points)

1 Answer

0 votes

Hi,

 

You can use session id to manage the session on Android device. How? At the time of authenticating the user, you have the session id in method response which you can save in local storage. Once you save the session id successfully, you can put the validation on the login screen. If session id exists then login into App else move him/her to a login screen. 

Let me know if it helps. 


Regards,

Himanshu Sharma

answered May 10, 2016 by hs00105 (2,005 points)
Hi, thanks for your answer. But I have another question, The Session ID is delivered when using the User service? I've created my own collection to store usernames and passwords, so if I do a query, do I still get a Session ID? And once I have the session ID stored, how can I use it to retrieve information from the database? How the server validates that user? Thanks
Hi Leandro,

In that case, I will suggest you to use session service of App42 to get the user session. Please have a look at this link(http://api.shephertz.com/app42-docs/session-management-service/) for the complete documentation. If you concern about your app users data, then I would suggest you create ACL enable app and use the above service (Session service) inside the custom code (http://api.shephertz.com/tutorial/Server-Side-Custom-Code/?index=customcode-wrd).

Why are we suggesting you use Session service inside the custom code? It is because of two reasons:
1. Anybody can see the logic of creating session for user by debugging your app code
2. For creating a session for a user is require admin key along with method call and if you embed the admin key inside the app, then any programmer can see it easily and change user data.

So please go through above link and let me know if you require any help from our side.

We are  happy to assist !!!

Regards,
Himanshu Sharma
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...