Skip to content

Commit 5014e27

Browse files
chore: review comments
1 parent f644e2e commit 5014e27

File tree

2 files changed

+31
-200
lines changed
  • src/pages
    • [platform]/build-a-backend/auth/concepts/external-identity-providers
    • gen1/[platform]/build-a-backend/auth/add-social-provider

2 files changed

+31
-200
lines changed

src/pages/[platform]/build-a-backend/auth/concepts/external-identity-providers/index.mdx

Lines changed: 18 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,7 @@ await signInWithRedirect({
368368
</InlineFilter>
369369

370370
<InlineFilter filters={["angular", "javascript", "nextjs", "react", "vue"]}>
371+
371372
{/* @TODO refactor with connect-your-frontend/sign-in */}
372373
## Set up your frontend
373374

@@ -389,65 +390,22 @@ await signInWithRedirect({
389390

390391
### Redirect URLs
391392

392-
For _Sign in Redirect URL(s)_ inputs, you can set one URL for local development and one for production. For example: `http://localhost:3000/` in dev and `https://www.example.com/` in production. The same is true for _Sign out Redirect URL(s)_.
393-
394-
If you have multiple redirect URLs, you'll need to pass them in your Amplify configuration. For example:
395-
396-
```javascript
397-
Amplify.configure({
398-
Auth: {
399-
Cognito: {
400-
loginWith: {
401-
oauth: {
402-
redirectSignIn: [
403-
'http://localhost:3000/',
404-
'https://www.example.com/'
405-
],
406-
redirectSignOut: [
407-
'http://localhost:3000/',
408-
'https://www.example.com/'
409-
],
410-
...oauthConfig
411-
}
412-
},
413-
...userPoolConfig
414-
}
415-
}
416-
});
417-
```
393+
_Sign in_ & _Sign out_ redirect URL(s) are used to redirect end users after the sign in or sign out operation has occurred. You may want to specify multiple URLs for various use-cases such as having different URLs for development/ production or redirect users to an intermediate URL before returning them to the app.
418394

419395
#### Specifying a redirect URL on sign out
420-
If you have multiple redirect urls configured, you may choose to override the default behavior of selecting a redirect url and provide the one of your choosing when calling `signOut`. The provided redirect url should match at least one of the configured redirect urls. If no redirect url is provided to `signOut`, one will be selected based on the current app domain.
396+
If you have multiple sign out redirect URLs configured, you may choose to override the default behavior of selecting a redirect URL and provide the one of your choosing when calling `signOut`. The provided redirect URL should match at least one of the configured redirect URLs. If no redirect URL is provided to `signOut`, one will be selected based on the current app domain.
421397

422398
```ts
423399
import { Amplify } from 'aws-amplify';
424400
import { signOut } from 'aws-amplify/auth';
425401

426-
Amplify.configure({
427-
Auth: {
428-
Cognito: {
429-
loginWith: {
430-
oauth: {
431-
redirectSignIn: [
432-
'http://localhost:3000/',
433-
'https://www.example.com/'
434-
],
435-
redirectSignOut: [
436-
'http://localhost:3000/',
437-
'https://www.example.com/'
438-
],
439-
...oauthConfig
440-
}
441-
},
442-
...userPoolConfig
443-
}
444-
}
445-
});
402+
// Assuming the following URLS were provided manually or via the Amplify configuration file,
403+
// redirectSignOut: 'http://localhost:3000/,https://authProvider/logout?logout_uri=https://mywebsite.com/'
446404

447405
signOut({
448406
global: false,
449407
oauth: {
450-
redirectUrl: 'https://www.example.com/'
408+
redirectUrl: 'https://authProvider/logout?logout_uri=https://mywebsite.com/'
451409
}
452410
});
453411

@@ -511,76 +469,33 @@ Use the `signInWithRedirect` API to initiate sign-in with an external identity p
511469
```ts title="src/my-client-side-js.js"
512470
import { signInWithRedirect } from 'aws-amplify/auth';
513471

514-
function handleSignInWithRedirect() {
515-
signInWithRedirect({
516-
provider: 'Apple'
517-
});
518-
}
472+
signInWithRedirect({
473+
provider: 'Apple'
474+
});
519475

520476
```
521477

522478
### Redirect URLs
523479

524-
If you want to manually configure multiple _Sign in_ & _Sign out_ redirect URL(s), you'll need to pass them in your Amplify configuration. For example:
525-
526-
```javascript
527-
Amplify.configure({
528-
Auth: {
529-
Cognito: {
530-
loginWith: {
531-
oauth: {
532-
redirectSignIn: [
533-
'myDevApp://'
534-
],
535-
redirectSignOut: [
536-
'myDevApp://',
537-
'myProdApp://'
538-
],
539-
...oauthConfig
540-
}
541-
},
542-
...userPoolConfig
543-
}
544-
}
545-
});
546-
```
480+
_Sign in_ & _Sign out_ redirect URL(s) are used to redirect end users after the sign in or sign out operation has occurred. You may want to specify multiple URLs for various use-cases such as having different URLs for development/ production or redirect users to an intermediate URL before returning them to the app.
547481

548482
#### Specifying a redirect URL on sign out
549-
If you have multiple redirect urls configured, you may choose to override the default behavior of selecting a redirect url and provide the one of your choosing when calling `signOut`. The provided redirect url should match at least one of the configured redirect urls. If no redirect url is provided to `signOut`, the first item from the the configured redirect urls list that does not contain a http nor https prefix will be picked.
483+
If you have multiple sign out redirect URLs configured, you may choose to override the default behavior of selecting a redirect URL and provide the one of your choosing when calling `signOut`. The provided redirect URL should match at least one of the configured redirect URLs. If no redirect URL is provided to `signOut`, the first item from the the configured redirect URLs list that does not contain a HTTP nor HTTPS prefix will be picked.
550484

551485
```ts
552486
import { Amplify } from 'aws-amplify';
553487
import { signOut } from 'aws-amplify/auth';
554488

555-
Amplify.configure({
556-
Auth: {
557-
Cognito: {
558-
loginWith: {
559-
oauth: {
560-
redirectSignIn: [
561-
'myDevApp://'
562-
],
563-
redirectSignOut: [
564-
'myDevApp://',
565-
'https://oidcProvider/?logout_uri=myDevApp://'
566-
],
567-
...oauthConfig
568-
}
569-
},
570-
...userPoolConfig
571-
}
489+
// Assuming the following URLS were provided manually or via the Amplify configuration file,
490+
// redirectSignOut: 'myDevApp://,https://authProvider/logout?logout_uri=myDevApp://'
491+
492+
signOut({
493+
global: false,
494+
oauth: {
495+
redirectUrl: 'https://authProvider/logout?logout_uri=myDevApp://'
572496
}
573497
});
574498

575-
function handleSignOut() {
576-
signOut({
577-
global: false,
578-
oauth: {
579-
redirectUrl: 'https://oidcProvider/?logout_uri=myDevApp://'
580-
}
581-
});
582-
}
583-
584499
```
585500
<Callout> Irrespective of whether a `redirectUrl` is provided to `signOut`, a URL that does not contain http or https is expected to be present in the configured redirect URL list. This is because iOS requires an appScheme when creating the web session. </Callout>
586501

src/pages/gen1/[platform]/build-a-backend/auth/add-social-provider/index.mdx

Lines changed: 13 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -741,66 +741,25 @@ function App() {
741741
742742
### Redirect URLs
743743
744-
If you want to manually configure multiple _Sign in_ & _Sign out_ redirect URL(s), you'll need to pass them in your Amplify configuration. For example:
745-
746-
```javascript
747-
Amplify.configure({
748-
Auth: {
749-
Cognito: {
750-
loginWith: {
751-
oauth: {
752-
redirectSignIn: [
753-
'myDevApp://'
754-
],
755-
redirectSignOut: [
756-
'myDevApp://',
757-
'myProdApp://'
758-
],
759-
...oauthConfig
760-
}
761-
},
762-
...userPoolConfig
763-
}
764-
}
765-
});
766-
```
744+
_Sign in_ & _Sign out_ redirect URL(s) are used to redirect end users after the sign in or sign out operation has occurred. You may want to specify multiple URLs for various use-cases such as having different URLs for development/ production or redirect users to an intermediate URL before returning them to the app.
767745
768746
#### Specifying a redirect URL on sign out
769-
If you have multiple redirect urls configured, you may choose to override the default behavior of selecting a redirect url and provide the one of your choosing when calling `signOut`. The provided redirect url should match at least one of the configured redirect urls. If no redirect url is provided to `signOut`, the first item from the the configured redirect urls list that does not contain a http nor https prefix will be picked.
747+
If you have multiple sign out redirect URLs configured, you may choose to override the default behavior of selecting a redirect URL and provide the one of your choosing when calling `signOut`. The provided redirect URL should match at least one of the configured redirect URLs. If no redirect URL is provided to `signOut`, the first item from the the configured redirect URLs list that does not contain a HTTP nor HTTPS prefix will be picked.
770748
771749
```ts
772750
import { Amplify } from 'aws-amplify';
773751
import { signOut } from 'aws-amplify/auth';
774752

775-
Amplify.configure({
776-
Auth: {
777-
Cognito: {
778-
loginWith: {
779-
oauth: {
780-
redirectSignIn: [
781-
'myDevApp://'
782-
],
783-
redirectSignOut: [
784-
'myDevApp://',
785-
'https://oidcProvider/?logout_uri=myDevApp://'
786-
],
787-
...oauthConfig
788-
}
789-
},
790-
...userPoolConfig
791-
}
753+
// Assuming the following URLS were provided manually or via the Amplify configuration file,
754+
// redirectSignOut: 'myDevApp://,https://authProvider/logout/?logout_uri=myDevApp://'
755+
756+
signOut({
757+
global: false,
758+
oauth: {
759+
redirectUrl: 'https://authProvider/logout/?logout_uri=myDevApp://'
792760
}
793761
});
794762

795-
function handleSignOut() {
796-
signOut({
797-
global: false,
798-
oauth: {
799-
redirectUrl: 'https://oidcProvider/?logout_uri=myDevApp://'
800-
}
801-
});
802-
}
803-
804763

805764
```
806765
<Callout> Irrespective of whether a `redirectUrl` is provided to `signOut`, a URL that does not contain http or https is expected to be present in the configured redirect URL list. This is because iOS requires an appScheme when creating the web session. </Callout>
@@ -811,32 +770,7 @@ function handleSignOut() {
811770
812771
### Redirect URLs
813772
814-
For _Sign in Redirect URL(s)_ inputs, you can set one URL for local development and one for production. For example: `http://localhost:3000/` in dev and `https://www.example.com/` in production. The same is true for _Sign out Redirect URL(s)_.
815-
816-
If you have multiple redirect URLs, you'll need to pass them in your Amplify configuration. For example:
817-
818-
```javascript
819-
Amplify.configure({
820-
Auth: {
821-
Cognito: {
822-
loginWith: {
823-
oauth: {
824-
redirectSignIn: [
825-
'http://localhost:3000/',
826-
'https://www.example.com/'
827-
],
828-
redirectSignOut: [
829-
'http://localhost:3000/',
830-
'https://www.example.com/'
831-
],
832-
...oauthConfig
833-
}
834-
},
835-
...userPoolConfig
836-
}
837-
}
838-
});
839-
```
773+
_Sign in_ & _Sign out_ redirect URL(s) are used to redirect end users after the sign in or sign out operation has occurred. You may want to specify multiple URLs for various use-cases such as having different URLs for development (`http://localhost:3000/`) production (`https://www.example.com/`) or redirect users to an intermediate URL before returning them to the app.
840774

841775
<Accordion title='Full Example using multiple redirect URLs' headingLevel='4' eyebrow='Example'>
842776

@@ -1010,32 +944,14 @@ function App() {
1010944
</Accordion>
1011945

1012946
#### Specifying a redirect URL on sign out
1013-
If you have multiple redirect urls configured, you may choose to override the default behavior of selecting a redirect url and provide the one of your choosing when calling `signOut`. The provided redirect url should match at least one of the configured redirect urls. If no redirect url is provided to `signOut`, one will be selected based on the current app domain.
947+
If you have multiple redirect URLs configured, you may choose to override the default behavior of selecting a redirect URL and provide the one of your choosing when calling `signOut`. The provided redirect URL should match at least one of the configured redirect URLs. If no redirect URL is provided to `signOut`, one will be selected based on the current app domain.
1014948

1015949
```ts
1016950
import { Amplify } from 'aws-amplify';
1017951
import { signOut } from 'aws-amplify/auth';
1018952
1019-
Amplify.configure({
1020-
Auth: {
1021-
Cognito: {
1022-
loginWith: {
1023-
oauth: {
1024-
redirectSignIn: [
1025-
'http://localhost:3000/',
1026-
'https://www.example.com/'
1027-
],
1028-
redirectSignOut: [
1029-
'http://localhost:3000/',
1030-
'https://www.example.com/'
1031-
],
1032-
...oauthConfig
1033-
}
1034-
},
1035-
...userPoolConfig
1036-
}
1037-
}
1038-
});
953+
// Assuming the following URLS were provided manually or via the Amplify configuration file,
954+
// redirectSignOut: 'http://localhost:3000/,https://www.example.com/'
1039955
1040956
signOut({
1041957
global: false,

0 commit comments

Comments
 (0)