Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,11 @@ import { listenForOAuthFlowCancellation } from '../utils/oauth/cancelOAuthFlow';
*
* @throws AuthTokenConfigException - Thrown when the user pool config is invalid.
* @throws OAuthNotConfigureException - Thrown when the oauth config is invalid.
* @param skipRedirectUrlValidation - Skip the redirect URL validation. Default is false.
*/
export async function signInWithRedirect(
input?: SignInWithRedirectInput,
skipRedirectUrlValidation = false,
): Promise<void> {
const authConfig = Amplify.getConfig().Auth?.Cognito;
assertTokenProviderConfig(authConfig);
Expand All @@ -57,6 +59,7 @@ export async function signInWithRedirect(
provider,
customState: input?.customState,
preferPrivateSession: input?.options?.preferPrivateSession,
skipRedirectUrlValidation,
});
}

Expand All @@ -66,12 +69,14 @@ const oauthSignIn = async ({
clientId,
customState,
preferPrivateSession,
skipRedirectUrlValidation,
}: {
oauthConfig: OAuthConfig;
provider: string;
clientId: string;
customState?: string;
preferPrivateSession?: boolean;
skipRedirectUrlValidation?: boolean;
}) => {
const { domain, redirectSignIn, responseType, scopes } = oauthConfig;
const randomState = generateState();
Expand All @@ -87,7 +92,10 @@ const oauthSignIn = async ({
: randomState;

const { value, method, toCodeChallenge } = generateCodeVerifier(128);
const redirectUri = getRedirectUrl(oauthConfig.redirectSignIn);

const redirectUri = skipRedirectUrlValidation
? oauthConfig.redirectSignIn[0]
: getRedirectUrl(oauthConfig.redirectSignIn);

if (isBrowser()) oAuthStore.storeOAuthInFlight(true);
oAuthStore.storeOAuthState(state);
Expand Down
2 changes: 1 addition & 1 deletion packages/aws-amplify/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@
"name": "[Auth] OAuth Auth Flow (Cognito)",
"path": "./dist/esm/auth/index.mjs",
"import": "{ signInWithRedirect, signOut, fetchAuthSession }",
"limit": "21.47 kB"
"limit": "21.52 kB"
},
{
"name": "[Storage] copy (S3)",
Expand Down