Skip to content
This repository has been archived by the owner on Mar 11, 2022. It is now read-only.

Commit

Permalink
Added example to percent encoding documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
ricellis committed Dec 4, 2019
1 parent 6483b29 commit 245cbb0
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,14 +156,20 @@ var Cloudant = require('@cloudant/cloudant');
var cloudant = Cloudant("http://MYUSERNAME:MYPASSWORD@localhost:5984");
~~~

**Note**: If you pass credentials in the user information subcomponent of the URL
then they must be [percent encoded](https://tools.ietf.org/html/rfc3986#section-3.2.1).
Specifically the characters `: / ? # [ ] @ %` _MUST_ be precent-encoded, other
characters _MAY_ be percent encoded.
**Note**: It is preferred to pass credentials using the `account`/`username` and
`password` configuration options rather than as part of the URL. However, if you
choose to pass credentials in the user information subcomponent of the URL then
they must be [percent encoded](https://tools.ietf.org/html/rfc3986#section-3.2.1).
Specifically within either the username or passowrd the characters `: / ? # [ ] @ %`
_MUST_ be precent-encoded, other characters _MAY_ be percent encoded.
For example for the username `user123` and password `colon:at@321`:
```
https://user123:colon%3aat%40321@localhost:5984
```
Credentials must not be percent encoded when passing them via other configuration
options besides `url`.

**Note**: If you pass in a `username`, `password`, and `url` that contains
If you pass in `username` and `password` options and a `url` that contains
credentials, the `username` and `password` will supercede the credentials within
the `url`. For example, `myusername` and `mypassword` will be used in the code
below during authentication:
Expand Down

0 comments on commit 245cbb0

Please sign in to comment.