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

Commit 245cbb0

Browse files
committed
Added example to percent encoding documentation
1 parent 6483b29 commit 245cbb0

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

README.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -156,14 +156,20 @@ var Cloudant = require('@cloudant/cloudant');
156156
var cloudant = Cloudant("http://MYUSERNAME:MYPASSWORD@localhost:5984");
157157
~~~
158158

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

166-
**Note**: If you pass in a `username`, `password`, and `url` that contains
172+
If you pass in `username` and `password` options and a `url` that contains
167173
credentials, the `username` and `password` will supercede the credentials within
168174
the `url`. For example, `myusername` and `mypassword` will be used in the code
169175
below during authentication:

0 commit comments

Comments
 (0)