You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{/* @TODO refactor with connect-your-frontend/sign-in */}
372
373
## Set up your frontend
373
374
@@ -389,65 +390,22 @@ await signInWithRedirect({
389
390
390
391
### Redirect URLs
391
392
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.
418
394
419
395
#### 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.
421
397
422
398
```ts
423
399
import { Amplify } from'aws-amplify';
424
400
import { signOut } from'aws-amplify/auth';
425
401
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,
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.
547
481
548
482
#### 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.
550
484
551
485
```ts
552
486
import { Amplify } from'aws-amplify';
553
487
import { signOut } from'aws-amplify/auth';
554
488
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,
<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>
Copy file name to clipboardExpand all lines: src/pages/gen1/[platform]/build-a-backend/auth/add-social-provider/index.mdx
+13-97Lines changed: 13 additions & 97 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -741,66 +741,25 @@ function App() {
741
741
742
742
### Redirect URLs
743
743
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.
767
745
768
746
#### 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.
770
748
771
749
```ts
772
750
import { Amplify } from'aws-amplify';
773
751
import { signOut } from'aws-amplify/auth';
774
752
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,
<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() {
811
770
812
771
### Redirect URLs
813
772
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.
840
774
841
775
<Accordion title='Full Example using multiple redirect URLs' headingLevel='4' eyebrow='Example'>
842
776
@@ -1010,32 +944,14 @@ function App() {
1010
944
</Accordion>
1011
945
1012
946
#### 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.
1014
948
1015
949
```ts
1016
950
import { Amplify } from 'aws-amplify';
1017
951
import { signOut } from 'aws-amplify/auth';
1018
952
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,
0 commit comments