0

I have an API eg. http://www.myportal.com/login and when we call this URL it asks for username and password and after successful login, it returns an access token.

Same thing I have to implement in Loopback4 by calling the above URL.

Please give some idea, will appreciate your help.

Jee Mok
  • 6,157
  • 8
  • 47
  • 80

1 Answers1

0

Based on your question, what you need to do is do authentication using passport-local strategy and then create a jwt token with authenticated user obtained.

But to do this, you will need to create a separate component with decorators and providers in loopback4. Loopback 4 team is working on ways to provide such features out of the box in the framework. But its not there yet.

We created a loopback extension for the same which supports 4 different passport strategies. You can use that from here. Hope it helps.

Samarpan
  • 913
  • 5
  • 12
  • Yes Samy you are right. Actually i was doing it through REST connector but due to LB4 limitation i have changed my approach done it through http-request and axios module. Thanks you your reply :) – Ranjeet May 17 '19 at 07:34