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
@@ -387,6 +388,29 @@ await signInWithRedirect({
387
388
});
388
389
```
389
390
391
+
### Redirect URLs
392
+
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.
394
+
395
+
#### Specifying a redirect URL on sign out
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.
397
+
398
+
```ts
399
+
import { Amplify } from'aws-amplify';
400
+
import { signOut } from'aws-amplify/auth';
401
+
402
+
// Assuming the following URLS were provided manually or via the Amplify configuration file,
@@ -430,6 +454,53 @@ When you import and use the `signInWithRedirect` function, it will add a listene
430
454
</Accordion>
431
455
</InlineFilter>
432
456
457
+
<InlineFilterfilters={["react-native"]}>
458
+
459
+
## Set up your frontend
460
+
461
+
<Calloutinfo>
462
+
463
+
If you are using the [Authenticator component](https://ui.docs.amplify.aws/react/connected-components/authenticator/configuration#external-providers) with Amplify, this feature works without any additional code. The guide below is for writing your own implementation.
464
+
465
+
</Callout>
466
+
467
+
Use the `signInWithRedirect` API to initiate sign-in with an external identity provider.
_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.
481
+
482
+
#### Specifying a redirect URL on sign out
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.
484
+
485
+
```ts
486
+
import { Amplify } from'aws-amplify';
487
+
import { signOut } from'aws-amplify/auth';
488
+
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>
501
+
502
+
</InlineFilter>
503
+
433
504
## Next steps
434
505
435
506
-[Learn how to sign in with external providers](/[platform]/build-a-backend/auth/connect-your-frontend/sign-in/#sign-in-with-an-external-identity-provider)
_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.
745
745
746
-
### Redirect URLs
746
+
#### Specifying a redirect URL on sign out
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.
747
748
748
-
For _Sign in Redirect URI(s)_ inputs, you can put one URI for local development and one for production. Example: `http://localhost:3000/` in dev and `https://www.example.com/` in production. The same is true for _Sign out redirect URI(s)_.
749
+
```ts
750
+
import { Amplify } from'aws-amplify';
751
+
import { signOut } from'aws-amplify/auth';
749
752
750
-
If you have multiple redirect URI inputs, you'll need to pass them in your Amplify configuration. For example:
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>
<Accordion title='Full Example using multiple redirect URIs' headingLevel='4' eyebrow='Example'>
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.
774
+
775
+
<Accordion title='Full Example using multiple redirect URLs' headingLevel='4' eyebrow='Example'>
776
776
777
777
<BlockSwitcher>
778
778
<Block name="TypeScript">
@@ -943,6 +943,25 @@ function App() {
943
943
944
944
</Accordion>
945
945
946
+
#### Specifying a redirect URL on sign out
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.
948
+
949
+
```ts
950
+
import { Amplify } from 'aws-amplify';
951
+
import { signOut } from 'aws-amplify/auth';
952
+
953
+
// Assuming the following URLS were provided manually or via the Amplify configuration file,
### (Required for Multi-Page Applications) Complete Social Sign In after Redirect
947
966
948
967
If you are developing a multi-page application, and the redirected page is not the same page that initiated the sign in, you will need to add the following code to the redirected page to ensure the sign in gets completed:
0 commit comments