[BUG] Mgt login runs after page load
I have been using mgt login but this always go to login after main page loads in .Net CORe web application.
I am importing the modules in html head but still no luck.
how can we call login method before the main/index page loads?
@Banda943224 could you provide us with a small reproduction of your project or some code samples of how you're using mgt?
import { registerMgtComponents, Providers, Msal2Provider, ProviderState } from 'https://unpkg.com/@microsoft/mgt@4'; Providers.globalProvider = new Msal2Provider({ clientId: XXXXXXXXXXXXXX', scopes: ['User.ReadBasic.All', 'User.Read.All', 'User.Read'], tenantid: "XXXXXXXXXXXXX", redirecturi: "XXXXXXXXXXXX", authority: "https://login.microsoftonline.com/XXXXXXXXXXXXXXX", isIncrementalConsentDisabled: true }); registerMgtComponents(); Providers.globalProvider.setState(ProviderState.SignedIn);
Am using above code in my asp.net core layout page.. in the head.. this is executing after the page load, which is concerning as MFA should be done first and then load the website page.
Can you please help me with it?
can you please create a complete repro that we can run without needing to create a web app etc. our staffing on this project is limited and everything you can do to help us understand your problem help us help you
I couldn't create the repo. but here is what I am doing.
- I have ASP.Net Core web application
- I would like to show the signed in user pic on the top of the web site
- Hence, I added mgt-person component
- I am currently using PCKE authentication method
- I am able to complete the auth method
- However, mgt-person component is not being initialized
- I have to forcefully use "Providers.globalProvider.login();" method to do this. but this is causing in redirecting/logging in webpage again and again
- I am stuck with this since long time.
- I have provided the code am using above
need ur help in fixing this. let me know if we can have quick call so that I can explain better if am not able to here.
@Banda943224 When creating mgt-person component, have you passed in the logged in user id to it? You can share a screenshot of this part of your app here if that's ok.
I am using above statement
Any update on this?
@Banda943224 we haven't been able to reproduce this currently, is there a reproduction you can share?
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.