@azure/msal-browser
Version:
Microsoft Authentication Library for js
62 lines (59 loc) • 2.97 kB
JavaScript
/*! @azure/msal-browser v5.25.0 2026-10-06 */
;
import { AuthFlowActionRequiredStateBase } from '../../../../core/auth_flow/AuthFlowState.mjs';
import { CustomAuthResultV2 } from '../../../../core/auth_flow/v2/CustomAuthResultV2.mjs';
import { CompletedStateV2 } from '../../../../core/auth_flow/v2/state/CompletedStateV2.mjs';
import { CustomAuthAccountData } from '../../../../get_account/auth_flow/CustomAuthAccountData.mjs';
import { SignInContinuationErrorV2 } from '../error_type/SignInContinuationErrorV2.mjs';
import { ensureArgumentIsJSONString } from '../../../../core/utils/ArgumentValidator.mjs';
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/
/**
* Shared state returned when a completed V2 flow can sign the user in by
* redeeming its continuation. Password reset and sign-up can both surface this
* state without duplicating the token-acquisition behavior.
*/
class SignInContinuationStateV2 extends AuthFlowActionRequiredStateBase {
constructor() {
super(...arguments);
this.stateType = "signInContinuation";
}
/**
* Signs the user in using the continuation established by the completed V2
* flow. On success the returned result reaches the completed state
* carrying the signed-in account data; on failure the result's error reports
* why the follow-up sign-in could not complete.
* @param inputs - Optional scopes requested for the issued token. Claims
* are accepted for API alignment but are not sent until the V2 service
* supports them on authorize-challenge.
* @returns The result of signing in after the password reset.
*/
async signIn(inputs) {
const { correlationId, logger, continuationState, flowClient } = this.stateParameters;
try {
if (inputs?.claims) {
ensureArgumentIsJSONString("inputs.claims", inputs.claims, correlationId);
}
logger.verbose("09mk3f", correlationId);
const result = await flowClient.signInWithContinuation({
correlationId,
continuationState,
scopes: inputs?.scopes,
});
const account = new CustomAuthAccountData(result.authenticationResult.account, this.stateParameters.config, this.stateParameters.cacheClient, logger, correlationId);
return new CustomAuthResultV2(new CompletedStateV2(), account, continuationState.scenario);
}
catch (error) {
logger.errorPii(`0zoo5u ${error}`, correlationId);
return CustomAuthResultV2.createWithError(error, {
errorType: SignInContinuationErrorV2,
scenario: continuationState.scenario,
correlationId,
});
}
}
}
export { SignInContinuationStateV2 };
//# sourceMappingURL=SignInContinuationStateV2.mjs.map