-
-
Couldn't load subscription status.
- Fork 28
added example how to add username and password to a request #79
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am unclear about the response example, and I think the plugin is pretty clear that it implements basic authentication (i.e. https://www.rfc-editor.org/rfc/rfc7617.html). So it seems redundant to me to add an example, but I suppose it doesn't hurt anything either. I would just remove the "send credentials back the client" portion as it isn't spec compliant and is a glaring security violation.
README.md
Outdated
| ### How to add credentials to a request | ||
| The basic-auth plugin retrieves the credentials from the [Authorization](https://en.wikipedia.org/wiki/Basic_access_authentication) header. | ||
|
|
||
| A simple example to add `username` and `password` to the reply header: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why would we give an example showing sending the credentials in a response header? https://www.rfc-editor.org/rfc/rfc7617.html does not call for this, and it seems like a bad practice to recommend.
README.md
Outdated
| fetch('URL_GOES_HERE', { | ||
| method: 'post', | ||
| headers: new Headers({ | ||
| 'Authorization': 'Basic '+btoa('username:password'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 'Authorization': 'Basic '+btoa('username:password'), | |
| 'Authorization': 'Basic ' + btoa('username:password'), |
- removed node example - changed misspelling - added spacing - changed 'URL_GOES_HERE' to 'https://www.example.org/'
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
resolves #78
Checklist
npm run testandnpm run benchmarkand the Code of conduct