Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loopback4 Authentication #5573

Closed
1 task
HrithikMittal opened this issue May 26, 2020 · 23 comments
Closed
1 task

Loopback4 Authentication #5573

HrithikMittal opened this issue May 26, 2020 · 23 comments

Comments

@HrithikMittal
Copy link
Contributor

HrithikMittal commented May 26, 2020

Suggestion

I know you already create docs for adding the Authentication in loopback4 using the shopping example. But for developers to understand is tough (for me also previously as there are some bugs into also- in docs.)

Use Cases

So, I create a repo with the Readme file where a complete processor and steps are mentions of implementing the Authentication is given. [Repo link: https://github.com/HrithikMittal/Loopback4-auth ]
I just give a bit of advice, If you can add the repo into yours or just add Readme would be beneficial for other developers.

Examples

Authentication of User.

https://github.com/HrithikMittal/Loopback4-auth

Acceptance criteria

@jannyHou jannyHou self-assigned this May 27, 2020
@mathias22osterhagen22
Copy link

I agree totally, I'm currently trying to add a simple user / login -> token into the API.
I'm fighting for 3 days, trying to make the tutorial in a loop + trying with the shopping example (that is not working) + passport example (that is not working too). It's so sad to see that the documentation is so hard to understand. When you go on the example for adding a JWT token authentification the page is soo long and messy, there is part of code referring to files that were made in the example but not mentioned, you need to read the doc and CTRL + F constantly in the app examples (that you can't run) (like figure out that there is a ./keys file in the shopping example).

@HrithikMittal thank you so much for this post that will probably help a lot of people in my case.
I hope the documentation will be updated regarding this point.

@HrithikMittal
Copy link
Contributor Author

Same I also suffered a lot and that's why I create a new project with complete steps (just go through the readme). I hope it will help you.
@mathias22osterhagen22

@achrinza achrinza added the Docs label May 27, 2020
@dougal83
Copy link
Contributor

Please bear in mind that examples like the lb4 shopping example app are constantly updated with new features. The example apps can fall out of sync with the documentation for features such as authentication. That being said, the lb4 shopping example should be a working copy that can referred to and reverse engineered into your own projects.

@madaky
Copy link
Contributor

madaky commented May 27, 2020

Extension @loopback/authentication-jwt, leverage off the burden from user to go from lots of manual work-offs. Just they need is small entries in their application.Yet this is under experimental release, but a good one to setup quick authentication.

@HrithikMittal
Copy link
Contributor Author

@dougal83 I completely agree with you but the lb4 shopping example app is not that easy to understand and here I just give the Authentication and the steps in Readme are very easy to understand.

@dougal83
Copy link
Contributor

@HrithikMittal I appreciate that the lb4 shopping example is a steep learning curve compared to a guide. There are several ways to look at docs, some people prefer different approaches. Hopefully your guide can be reviewed and used to improve docs. Your proposal looks decent, let's see how it goes and as @madaky mentions there is still active development in progress so things can still change.

@jannyHou
Copy link
Contributor

jannyHou commented May 28, 2020

Hi everyone, there are gaps between the auth doc and auth modules, I am rewriting the doc to reflect the latest change. PRs coming soon.
Sorry for the confusion ^

@HrithikMittal
Copy link
Contributor Author

Hi @jannyHou Please can you check this repo also I create a new one for the Authorization https://github.com/HrithikMittal/loopback4-authorization
Again I mention all the steps of how to do it. I hope it will be more beneficial for others to understand as there is a lot of confusion in official docs.

@jannyHou
Copy link
Contributor

jannyHou commented May 28, 2020

@HrithikMittal Thank you! For https://github.com/HrithikMittal/Loopback4-auth, I think it's an improvement of the jwt tutorial in shopping example. The jwt module in shopping example is created very early and unfortunately we didn't update it in time to reflect the latest change.

Now we have a much easier tutorial to get people on board with authentication using https://github.com/strongloop/loopback-next/tree/master/extensions/authentication-jwt and https://github.com/strongloop/loopback-next/tree/master/examples/todo-jwt, the documentation is in build.

And I have a plan to refactor the scattered auth docs in #5294 (comment), feedback is welcomed!

@jannyHou
Copy link
Contributor

I see https://github.com/HrithikMittal/Loopback4-auth is a standalone module, I will make https://github.com/HrithikMittal/Loopback4-auth as the "Advanced tutorial for implement your own JWT auth module"

@HrithikMittal
Copy link
Contributor Author

Thank you @jannyHou and please tell me where you make it as you mention in your comment.
Apart from this If you want me to change anything in this module folder or file or in Readme please let me know I will do it.
Please also check this issue #5595 and
this also #110 I would like to contribute more to this project and make things easier for developers to understand.

@jannyHou
Copy link
Contributor

jannyHou commented Jun 2, 2020

Hi @HrithikMittal and everyone gets blocked by the authentication documentation. I started a refactor PR in #5598, and there will be more coming in the next few days to create the new skeleton of the auth doc.

I understand the concern and frustration of seeing the out-of-date but before I create the new layout, it's hard to tell community the criteria of follow-up stories :(

Please also check this issue #5595 and
this also #110 I would like to contribute more to this project and make things easier for developers to understand.

👍 👍 We really appreciate your help, and I will let you know the plan details asap when I finish ^

@jannyHou
Copy link
Contributor

jannyHou commented Jun 9, 2020

An update:

A few PRs are created to re-structure the authentication doc:

Since #5294 is used to track the new structure of doc. I would like to turn this story to be an improvement of the new doc. Updated the acceptance criteria as:

Add https://github.com/HrithikMittal/Loopback4-auth as an example tutorial after re-structing the authentiation doc in #5294

There are many good examples within this monorepo and from community. We will add them soon after #5598 merged. And https://github.com/HrithikMittal/Loopback4-auth is definitely an outstanding one :)

@jannyHou jannyHou removed their assignment Jun 9, 2020
@HrithikMittal
Copy link
Contributor Author

HrithikMittal commented Jun 9, 2020

thank you @jannyHou

@jannyHou
Copy link
Contributor

jannyHou commented Jun 19, 2020

The passport example should work after fixing #5766.

@HrithikMittal
Copy link
Contributor Author

Sorry @jannyHou but it is still not working I just follow these commands

lb4 example
> passport-login
cd loopback4-example-passport-login
npm install

image

@dougal83
Copy link
Contributor

dougal83 commented Jun 24, 2020

@HrithikMittal It seems that you are requesting a package from npm that does not exist or is not published yet. See https://www.npmjs.com/package/@loopback/mock-oauth2-provider and it's only v0.1.0.

Although you can clone the loopback-next repo and use the change in the example, you may have to wait for @loopback/mock-oauth2-provider v0.1.1 to be published to use in your own project.

@jannyHou
Copy link
Contributor

@dougal83 @HrithikMittal good catch, #5855 next publish should have the right version.

@dhmlau
Copy link
Member

dhmlau commented Jul 16, 2020

@jannyHou, the 5 items you described #5573 (comment) are done. Is this issue good to close? Thanks.

@HrithikMittal
Copy link
Contributor Author

Hey, @dhmlau Can you tell me where you add it as an example.

Add https://github.com/HrithikMittal/Loopback4-auth as an example tutorial after re-structing the authentiation doc in #5294

@dhmlau
Copy link
Member

dhmlau commented Jul 16, 2020

@HrithikMittal, I didn't realize the acceptance criteria is different from the 5 items listed in #5573 (comment). 😔

@jannyHou, if we're going to add https://github.com/HrithikMittal/Loopback4-auth as the example tutorial, since it's coming from @HrithikMittal, I think it might be better for @HrithikMittal to submit a PR to add the example for the authorship. It will include (can be separate PRs):

  1. add the app under examples folder.
  2. add it to the Examples page: https://loopback.io/doc/en/lb4/Examples.html.
  3. update the lb4 example cli to include this example

@jannyHou @HrithikMittal, WDYT?

@HrithikMittal
Copy link
Contributor Author

Okay @dhmlau I will create one PR for this.
Thanks

@jannyHou
Copy link
Contributor

jannyHou commented Jul 27, 2020

Closing this issue as #5999 merged.

Now the example https://github.com/HrithikMittal/Loopback4-auth is listed on the overview page!

Other refactors mentioned in this issue are addressed in #5294

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants