Skip to content

Commit b956410

Browse files
DOC-4989 implemented PR feedback
1 parent f2901f1 commit b956410

File tree

1 file changed

+14
-12
lines changed
  • content/develop/clients/nodejs

1 file changed

+14
-12
lines changed

content/develop/clients/nodejs/amr.md

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ Install [`node-redis`]({{< relref "/develop/clients/nodejs" >}}) and
3232
`@redis/entraid` with the following commands:
3333

3434
```bash
35-
npm install "@redis/client@5.0.0-next.6"
36-
npm install "@redis/entraid@5.0.0-next.6"
35+
npm install "@redis/client"
36+
npm install "@redis/entraid"
3737
```
3838

3939
## Create a credentials provider instance
@@ -46,7 +46,7 @@ Import `EntraIdCredentialsProviderFactory` with the following code:
4646

4747
```js
4848
import { EntraIdCredentialsProviderFactory }
49-
from '@redis/entraid/dist/lib/entra-id-credentials-provider-factory';
49+
from '@redis/entraid';
5050
```
5151

5252
Then, use the appropriate factory method to create your credentials provider:
@@ -100,7 +100,7 @@ below:
100100
elapse before a refresh is triggered. For example, a value of 0.75 means the token
101101
should be refreshed when 75% of its lifetime has elapsed.
102102
- `retry`: This object specifies the policy to retry refreshing the token if the
103-
first attempt fails. It has the following fields:
103+
an error occurs. It has the following fields:
104104
- `maxAttempts`: The maximum number of times to attempt a refresh before
105105
aborting.
106106
- `initialDelayMs`: The delay (in milliseconds) before retrying after the
@@ -120,11 +120,13 @@ below:
120120
`(error, attempt) => boolean`<br/><br/>
121121
where `error` is the error object from
122122
a failed attempt and `attempt` is the number of attempts previously made.
123-
The `boolean` return value is `true` if another attempt should be made
124-
to refresh the token and `false` otherwise. Implement your own custom
125-
logic in this function to determine when to abort retrying. For example,
126-
you might detect when a particular error is fatal, or vary the number of
127-
attempts depending on the error type.
123+
This function classifies errors from the identity provider as
124+
retryable (returning `true`) or non-retryable (returning `false`).
125+
Implement your own custom logic here to determine if a token refresh failure
126+
should be retried, based on the type of error. For example, a refresh failure
127+
caused by a transient network error would probably succeed eventually if you retry
128+
it, but an invalid certificate is generally a fatal error. If you don't supply a custom
129+
function in this parameter, the default behavior is to retry all types of errors.
128130

129131
#### **authorityConfig**
130132

@@ -278,7 +280,7 @@ The example below shows how to use `createForDefaultAzureCredential()`:
278280
```js
279281
import { DefaultAzureCredential } from '@azure/identity';
280282
import { EntraIdCredentialsProviderFactory, REDIS_SCOPE_DEFAULT }
281-
from '@redis/entraid/dist/lib/entra-id-credentials-provider-factory';
283+
from '@redis/entraid';
282284

283285
// ...
284286

@@ -318,7 +320,7 @@ The example below shows how to pass the instance as a parameter to the standard
318320
```js
319321
import { createClient } from '@redis/client';
320322
import { EntraIdCredentialsProviderFactory }
321-
from '@redis/entraid/dist/lib/entra-id-credentials-provider-factory';
323+
from '@redis/entraid';
322324

323325
// Create credentials provider instance...
324326

@@ -352,7 +354,7 @@ You must reconnect with fresh tokens when this happens.
352354
If you use
353355
[transactions](https://redis.io/docs/latest/develop/clients/nodejs/transpipe)
354356
in code that also uses token-based authentication, ensure that you use
355-
the `node-js` transaction API rather than explicit commands to create
357+
the `node-redis` client multi/exec API rather than explicit commands to create
356358
each transaction (see
357359
[Execute a transaction](https://redis.io/docs/latest/develop/clients/nodejs/transpipe/#execute-a-transaction)
358360
for an example of correct usage).

0 commit comments

Comments
 (0)