Skip to content

Commit d7b52ce

Browse files
Update examples for v2 (#392)
Co-authored-by: Rita Zerrizuela <[email protected]>
1 parent c591582 commit d7b52ce

File tree

1 file changed

+32
-14
lines changed

1 file changed

+32
-14
lines changed

EXAMPLES.md

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,9 @@ import { AuthModule } from '@auth0/auth0-angular';
154154
AuthModule.forRoot({
155155
domain: 'YOUR_AUTH0_DOMAIN',
156156
clientId: 'YOUR_AUTH0_CLIENT_ID',
157-
audience: 'YOUR_AUTH0_API_IDENTIFIER',
157+
authorizationParams: {
158+
audience: 'YOUR_AUTH0_API_IDENTIFIER',
159+
}
158160
}),
159161
],
160162
// ...
@@ -223,8 +225,10 @@ AuthModule.forRoot({
223225
{
224226
uri: '/api/accounts/*',
225227
tokenOptions: {
226-
audience: 'http://my-api/',
227-
scope: 'read:accounts',
228+
authorizationParams: {
229+
audience: 'http://my-api/',
230+
scope: 'read:accounts',
231+
}
228232
},
229233
},
230234

@@ -233,17 +237,21 @@ AuthModule.forRoot({
233237
uri: '/api/orders',
234238
httpMethod: HttpMethod.Post,
235239
tokenOptions: {
236-
audience: 'http://my-api/',
237-
scope: 'write:orders',
240+
authorizationParams: {
241+
audience: 'http://my-api/',
242+
scope: 'write:orders',
243+
}
238244
},
239245
},
240246

241247
// Using an absolute URI
242248
{
243249
uri: 'https://your-domain.auth0.com/api/v2/users',
244250
tokenOptions: {
245-
audience: 'https://your-domain.com/api/v2/',
246-
scope: 'read:users',
251+
authorizationParams: {
252+
audience: 'https://your-domain.com/api/v2/',
253+
scope: 'read:users',
254+
}
247255
},
248256
},
249257
],
@@ -266,8 +274,10 @@ AuthModule.forRoot({
266274
uriMatcher: (uri) => uri.indexOf('/api/orders') > -1,
267275
httpMethod: HttpMethod.Post,
268276
tokenOptions: {
269-
audience: 'http://my-api/',
270-
scope: 'write:orders',
277+
authorizationParams: {
278+
audience: 'http://my-api/',
279+
scope: 'write:orders',
280+
}
271281
},
272282
},
273283
],
@@ -316,7 +326,9 @@ Log in to an organization by specifying the `organization` parameter importing t
316326
AuthModule.forRoot({
317327
domain: 'YOUR_AUTH0_DOMAIN',
318328
clientId: 'YOUR_AUTH0_CLIENT_ID',
319-
organization: 'YOUR_ORGANIZATION_ID'
329+
authorizationParams: {
330+
organization: 'YOUR_ORGANIZATION_ID'
331+
}
320332
}),
321333
```
322334
@@ -325,12 +337,16 @@ You can also specify the organization when logging in:
325337
```
326338
// Using a redirect
327339
this.auth.loginWithRedirect({
328-
organization: 'YOUR_ORGANIZATION_ID'
340+
authorizationParams: {
341+
organization: 'YOUR_ORGANIZATION_ID'
342+
}
329343
});
330344

331345
// Using a popup window
332346
this.auth.loginWithPopup({
333-
organization: 'YOUR_ORGANIZATION_ID'
347+
authorizationParams: {
348+
organization: 'YOUR_ORGANIZATION_ID'
349+
}
334350
});
335351
```
336352
@@ -354,8 +370,10 @@ export class AppComponent {
354370
const { organization, invitation } = this.activatedRoute.snapshot.params;
355371

356372
this.auth.loginWithRedirect({
357-
organization,
358-
invitation
373+
authorizationParams: {
374+
organization,
375+
invitation
376+
}
359377
});
360378
}
361379
}

0 commit comments

Comments
 (0)