Skip to content

Commit 50f072f

Browse files
committed
feat: add documentation for signInWithRedirect changes
1 parent 2226dc2 commit 50f072f

File tree

1 file changed

+20
-3
lines changed
  • src/pages/[platform]/build-a-backend/auth/concepts/external-identity-providers

1 file changed

+20
-3
lines changed

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

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ export const auth = defineAuth({
314314

315315
### Attribute mapping
316316

317-
Identity provider (IdP) services store user attributes in different formats. When using external IdPs with Amazon Cognito user pools, attribute mapping allows you to standardize these varying formats into a consistent schema.
317+
Identity provider (IdP) services store user attributes in different formats. When using external IdPs with Amazon Cognito user pools, attribute mapping allows you to standardize these varying formats into a consistent schema.
318318

319319
Learn more about [mapping IdP attributes to user pool profiles and tokens](https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pools-specifying-attribute-mapping.html).
320320

@@ -552,9 +552,26 @@ await signInWithRedirect({
552552
});
553553
```
554554

555+
By default the current browser tab is used to initiate the sign-in process.
556+
In some rare cases this behavior might need to be adjusted, which can be achieved by using the `authSessionOpener` option
557+
558+
```ts title="src/example.js"
559+
import { signInWithRedirect } from 'aws-amplify/auth';
560+
561+
await signInWithRedirect({
562+
provider: 'Amazon',
563+
options: {
564+
authSessionOpener: (url: string) => {
565+
// initiate the sign-in process with the external identity provider
566+
window.location.href = url;
567+
}
568+
}
569+
});
570+
```
571+
555572
### Redirect URLs
556573

557-
_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.
574+
_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.
558575

559576
#### Specifying a redirect URL on sign out
560577
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.
@@ -640,7 +657,7 @@ signInWithRedirect({
640657

641658
### Redirect URLs
642659

643-
_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.
660+
_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.
644661

645662
#### Specifying a redirect URL on sign out
646663
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.

0 commit comments

Comments
 (0)