@@ -32,8 +32,8 @@ Install [`node-redis`]({{< relref "/develop/clients/nodejs" >}}) and
32
32
` @redis/entraid ` with the following commands:
33
33
34
34
``` 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"
37
37
```
38
38
39
39
## Create a credentials provider instance
@@ -46,7 +46,7 @@ Import `EntraIdCredentialsProviderFactory` with the following code:
46
46
47
47
``` js
48
48
import { EntraIdCredentialsProviderFactory }
49
- from ' @redis/entraid/dist/lib/entra-id-credentials-provider-factory ' ;
49
+ from ' @redis/entraid' ;
50
50
```
51
51
52
52
Then, use the appropriate factory method to create your credentials provider:
@@ -100,7 +100,7 @@ below:
100
100
elapse before a refresh is triggered. For example, a value of 0.75 means the token
101
101
should be refreshed when 75% of its lifetime has elapsed.
102
102
- ` 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:
104
104
- ` maxAttempts ` : The maximum number of times to attempt a refresh before
105
105
aborting.
106
106
- ` initialDelayMs ` : The delay (in milliseconds) before retrying after the
@@ -120,11 +120,13 @@ below:
120
120
` (error, attempt) => boolean ` <br /><br />
121
121
where ` error ` is the error object from
122
122
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.
128
130
129
131
#### ** authorityConfig**
130
132
@@ -278,7 +280,7 @@ The example below shows how to use `createForDefaultAzureCredential()`:
278
280
``` js
279
281
import { DefaultAzureCredential } from ' @azure/identity' ;
280
282
import { EntraIdCredentialsProviderFactory , REDIS_SCOPE_DEFAULT }
281
- from ' @redis/entraid/dist/lib/entra-id-credentials-provider-factory ' ;
283
+ from ' @redis/entraid' ;
282
284
283
285
// ...
284
286
@@ -318,7 +320,7 @@ The example below shows how to pass the instance as a parameter to the standard
318
320
``` js
319
321
import { createClient } from ' @redis/client' ;
320
322
import { EntraIdCredentialsProviderFactory }
321
- from ' @redis/entraid/dist/lib/entra-id-credentials-provider-factory ' ;
323
+ from ' @redis/entraid' ;
322
324
323
325
// Create credentials provider instance...
324
326
@@ -352,7 +354,7 @@ You must reconnect with fresh tokens when this happens.
352
354
If you use
353
355
[ transactions] ( https://redis.io/docs/latest/develop/clients/nodejs/transpipe )
354
356
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
356
358
each transaction (see
357
359
[ Execute a transaction] ( https://redis.io/docs/latest/develop/clients/nodejs/transpipe/#execute-a-transaction )
358
360
for an example of correct usage).
0 commit comments