Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EditProfile/EditPhone/EditEmail doesn't trigger on first redirect to app. #6385

Closed
doug-williamson opened this issue Aug 24, 2023 · 12 comments
Closed
Assignees
Labels
msal-angular Related to @azure/msal-angular package msal-browser Related to msal-browser package Needs: Attention 👋 Awaiting response from the MSAL.js team no-issue-activity Issue author has not responded in 5 days public-client Issues regarding PublicClientApplications question Customer is asking for a clarification, use case or information.

Comments

@doug-williamson
Copy link

Core Library

MSAL.js (@azure/msal-browser)

Core Library Version

3.0.2

Wrapper Library

MSAL Angular (@azure/msal-angular)

Wrapper Library Version

3.0.2

Public or Confidential Client?

Public

Description

After completing an Edit policy page (EditProfile, EditPhone, EditEmail), I need to grab the claims object for the account that was just edited.

I'm noticing, when navigating back to my app, that the ACQUIRE_TOKEN_SUCCESS EventType isn't being triggered for my three policies on the first try. Every subsequent Edit policy save works fine.

I notice that I'm getting a new MSSTS authorityType key/value pair in my sessionStorage, but it doesn't seem to be added until after the ACQUIRE_TOKEN_SUCCESS triggers for the default SignIn policy first.

MSAL Configuration

export function MSALInstanceFactory(): IPublicClientApplication {
	return new PublicClientApplication({
		auth: {
			clientId: isIgniteReHost() ? environment.msalConfig.auth.igniteReClientId : environment.msalConfig.auth.standaloneClientId,
			authority: environment.b2cPolicies.authorities.signIn.authority,
			redirectUri: environment.msalConfig.auth.logoutRedirectUri,
			postLogoutRedirectUri: environment.msalConfig.auth.logoutRedirectUri,
			knownAuthorities: [environment.b2cPolicies.authorityDomain],
			navigateToLoginRequestUrl: false,
		},
		cache: {
			cacheLocation: BrowserCacheLocation.SessionStorage,
		},
		system: {
			loggerOptions: {
				loggerCallback,
				logLevel: LogLevel.Verbose,
				piiLoggingEnabled: false,
			},
		},
	});
}

Relevant Code Snippets

In my app.component.ts ngOnInit():

this.msalBroadcastService.msalSubject$
			.pipe(
				filter((msg: EventMessage) => msg.eventType == EventType.ACQUIRE_TOKEN_SUCCESS),
				takeUntil(this._destroying$),
			)
			.subscribe((result: EventMessage) => {
				if (result.payload) {
					let payload = result.payload as AuthenticationResult;
					let idtoken = payload.idTokenClaims as IdTokenClaimsWithPolicyId;
					let accessToken = payload.accessToken;
					this.storageService.setItem('AccessToken', accessToken);

					switch (true) {
						case this.checkIdTokenForPolicy(idtoken, environment.b2cPolicies.names.editProfile.toLowerCase()) ||
							this.checkIdTokenForPolicy(idtoken, environment.b2cPolicies.names.editPhone.toLowerCase()) ||
							this.checkIdTokenForPolicy(idtoken, environment.b2cPolicies.names.editEmail.toLowerCase()):
							this.router.navigateByUrl('/profile-updated');
							break;
					}
					return result;
				}
			});

Identity Provider

Azure AD / MSA

Source

External (Customer)

@doug-williamson doug-williamson added the question Customer is asking for a clarification, use case or information. label Aug 24, 2023
@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs: Attention 👋 Awaiting response from the MSAL.js team label Aug 24, 2023
@github-actions github-actions bot added msal-angular Related to @azure/msal-angular package msal-browser Related to msal-browser package public-client Issues regarding PublicClientApplications labels Aug 24, 2023
@lalimasharda
Copy link
Contributor

Hey @doug-williamson , can you please provide some more clarity on the flow here. After you save the edit policy page, you are redirecting back to your app right? what do you do after you redirect back to your app? Are you making an acquire token call?

@microsoft-github-policy-service microsoft-github-policy-service bot added Needs: Author Feedback Awaiting response from issue author and removed Needs: Attention 👋 Awaiting response from the MSAL.js team labels Aug 25, 2023
@microsoft-github-policy-service
Copy link
Contributor

@doug-williamson This issue has been automatically marked as stale because it is marked as requiring author feedback but has not had any activity for 5 days. If your issue has been resolved please let us know by closing the issue. If your issue has not been resolved please leave a comment to keep this open. It will be closed automatically in 7 days if it remains stale.

@microsoft-github-policy-service microsoft-github-policy-service bot added the no-issue-activity Issue author has not responded in 5 days label Aug 31, 2023
@doug-williamson
Copy link
Author

Hi @lalimasharda. Yes, I'm being redirected to my app after EditProfile policy, and am not doing any kind of acquire token call. Will that be necessary for me to pick up the ACQUIRE_TOKEN_SUCCESS event type?

@microsoft-github-policy-service microsoft-github-policy-service bot added Needs: Attention 👋 Awaiting response from the MSAL.js team and removed Needs: Author Feedback Awaiting response from issue author labels Sep 6, 2023
@microsoft-github-policy-service
Copy link
Contributor

This issue requires attention from the MSAL.js team and has not seen activity in 5 days. @lalimasharda please follow up.

3 similar comments
@microsoft-github-policy-service
Copy link
Contributor

This issue requires attention from the MSAL.js team and has not seen activity in 5 days. @lalimasharda please follow up.

@microsoft-github-policy-service
Copy link
Contributor

This issue requires attention from the MSAL.js team and has not seen activity in 5 days. @lalimasharda please follow up.

@microsoft-github-policy-service
Copy link
Contributor

This issue requires attention from the MSAL.js team and has not seen activity in 5 days. @lalimasharda please follow up.

@microsoft-github-policy-service
Copy link
Contributor

This issue requires attention from the MSAL.js team and has not seen activity in 5 days. @lalimasharda please follow up.

4 similar comments
@microsoft-github-policy-service
Copy link
Contributor

This issue requires attention from the MSAL.js team and has not seen activity in 5 days. @lalimasharda please follow up.

@microsoft-github-policy-service
Copy link
Contributor

This issue requires attention from the MSAL.js team and has not seen activity in 5 days. @lalimasharda please follow up.

@microsoft-github-policy-service
Copy link
Contributor

This issue requires attention from the MSAL.js team and has not seen activity in 5 days. @lalimasharda please follow up.

@microsoft-github-policy-service
Copy link
Contributor

This issue requires attention from the MSAL.js team and has not seen activity in 5 days. @lalimasharda please follow up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
msal-angular Related to @azure/msal-angular package msal-browser Related to msal-browser package Needs: Attention 👋 Awaiting response from the MSAL.js team no-issue-activity Issue author has not responded in 5 days public-client Issues regarding PublicClientApplications question Customer is asking for a clarification, use case or information.
Projects
None yet
Development

No branches or pull requests

2 participants