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

docs: update tutorial on creating/registering a custom authentication strategy in LoopBack 4 #3876

Merged
merged 1 commit into from
Oct 10, 2019

Conversation

emonddr
Copy link
Contributor

@emonddr emonddr commented Oct 4, 2019

Need to update this tutorial to make use of 'Authorize' button in API Explorer.

This capability was added by specifying certain OpenAPI security scheme settings in
the shopping cart application (see PR loopbackio/loopback4-example-shopping#301).

Instead of using a REST client application to interact with endpoints that need a JWT token to be passed in an Authorization header in a request, the user can now use the API Explorer to do this.

Connected to #3740

Checklist

👉 Read and sign the CLA (Contributor License Agreement) 👈

  • npm test passes on your machine
  • New tests added or existing tests modified to cover all changes
  • Code conforms with the style guide
  • API Documentation in code was updated
  • Documentation in /docs/site was updated
  • Affected artifact templates in packages/cli were updated
  • Affected example projects in examples/* were updated

👉 Check out how to submit a PR 👈

@emonddr emonddr changed the title docs: update 'try it out' section docs: update tutorial on creating/registering a custom authentication strategy in LoopBack 4 Oct 4, 2019
@emonddr
Copy link
Contributor Author

emonddr commented Oct 4, 2019

Updated the try it out section.

@emonddr
Copy link
Contributor Author

emonddr commented Oct 4, 2019

Now I need to add a new section describing the steps we took in PR loopbackio/loopback4-example-shopping#301 to make the Authorize button functionality work in the API Explorer. Forthcoming...

@emonddr emonddr force-pushed the dremond_openapi_auth_token_docs branch 4 times, most recently from f9f8ed7 to 950b659 Compare October 4, 2019 21:18
@emonddr emonddr changed the title docs: update tutorial on creating/registering a custom authentication strategy in LoopBack 4 [WIP] docs: update tutorial on creating/registering a custom authentication strategy in LoopBack 4 Oct 7, 2019
@emonddr emonddr force-pushed the dremond_openapi_auth_token_docs branch 7 times, most recently from 2b939e9 to e335c21 Compare October 7, 2019 20:18
@emonddr
Copy link
Contributor Author

emonddr commented Oct 7, 2019

Added a new section: Specifying the Security Settings in the OpenAPI Specification.

@emonddr emonddr changed the title [WIP] docs: update tutorial on creating/registering a custom authentication strategy in LoopBack 4 docs: update tutorial on creating/registering a custom authentication strategy in LoopBack 4 Oct 7, 2019
Copy link
Contributor

@agnes512 agnes512 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good writeup 👍

@emonddr emonddr force-pushed the dremond_openapi_auth_token_docs branch 4 times, most recently from c762f37 to f352c78 Compare October 9, 2019 18:48
Copy link
Member

@dhmlau dhmlau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've read the instruction but haven't tried it yet.

@@ -79,11 +79,11 @@ application, follow these steps:
Try http://[::1]:3000/ping
```

2. In a browser, navigate to [http://[::1]:3000](http://127.0.0.1:3000) or
1. In a browser, navigate to [http://[::1]:3000](http://127.0.0.1:3000) or
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • In the "view file", the number is correct, but maybe we should use the right numbering?
  • another nitpick: do we want to point user directly to API Explorer URL http://127.0.0.1:3000/explorer, instead of go to the root and click explorer. No strong opinion, just think this might be simpler.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the "view file", the number is correct, but maybe we should use the right numbering?

I noticed that for numbered lists in MD format, you can specify 1. every time
so that is automatically renumbers for you. See https://www.markdownguide.org/basic-syntax/#ordered-lists .

Otherwise, we have to keep the numbering in proper order ourselves. Making them all 1. saves us the hassle.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

another nitpick: do we want to point user directly to API Explorer URL http://127.0.0.1:3000/explorer, instead of go to the root and click explorer. No strong opinion, just think this might be simpler.

I guess I wanted them to see this screen:

image

also, when they execute : npm start is outputs

image

which tells them the server is starting at localhost:3000 ; and some users expect a home page for the server at that address.

I guess I wanted to show them there is a home screen, and they have two links to choose from.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@emonddr emonddr force-pushed the dremond_openapi_auth_token_docs branch from f352c78 to ea4ecee Compare October 9, 2019 20:04
succeeds, the
[user profile](https://github.com/strongloop/loopback-next/blob/master/packages/authentication/src/types.ts)
1. Scroll to the top of the API Explorer, and you should see an `Authorize`
button. This the place where you can set the JWT token.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: This --> This is

Copy link
Contributor

@jannyHou jannyHou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM in general, very detailed steps 👍

Can you also add a few note to explain that we have a plan to automatically bind the security spec (contributed by the authentication strategy) in story #3854 and #3669?

Update the authentication tutorial with OpenAPI specification
security scheme/requirement object declarations in order
to enable the 'Authorize' button/dialog functionality
in the API Explorer.
@emonddr emonddr force-pushed the dremond_openapi_auth_token_docs branch from ea4ecee to 4a67c48 Compare October 10, 2019 16:39
@emonddr emonddr merged commit 4fb9f39 into master Oct 10, 2019
@emonddr emonddr deleted the dremond_openapi_auth_token_docs branch October 10, 2019 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants