Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Authenticating Android app with PassportJS

I have been using passportjs for user authentication on my web application. Now, I am working on Android Client for same project. When I logged in with local strategy, I was successfully logged in on Android. However, after logging in, when I tried to get data from another URI on my server, I got 'Invalid Username or Password'.

When I checked req, there was no req.user object when android asked for data on a particular URI. When accessing the same URI from web application, it contained the user data on req.user object. There was nothing in the case of Android.

I learnt that for Android, we do token-based authentication. Then I came across bearer strategy in passport js. It had some options of redirect URLs. I think I can't handle redirect URLs in Android App. I have already done a lot of work using passport local strategy. Kindly, let me know what should I do or look into if I want to use the same strategy for my android application too.

like image 514
SamFast Avatar asked Feb 02 '26 21:02

SamFast


1 Answers

I have found the answer to my this question on following thread. Posting it here, it might help someone else.

https://plus.google.com/u/0/+SojharoMangi/posts/N1d5XQawSnU

like image 83
SamFast Avatar answered Feb 04 '26 12:02

SamFast



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!