@azure/[email protected]error TS2339: Property 'setActiveAccount' does not exist on type 'IPublicClientApplication'.
I have tried latest version of sample provided by here: https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-angular-v2-samples. I have tried angular 11 B2C and with B2C but in both sample it give error like
Property 'setActiveAccount' does not exist on type 'IPublicClientApplication'.
I am using below versions:
"@azure/msal-angular": "^2.0.0-alpha.1",
"@azure/msal-browser": "^2.8.0",
@jo-arroyo could you please let me know if I am using wrong version?
Thanks,
Jitendra Prajapati
I get the same issue when starting the application, however it will run and allow me to authenticate, However, when I try and access my profile I get error: "Uncaught (in promise): Error: Invalid CanActivateChild guard" in core.js
@jitendraP-ashutec setActiveAccount is part of a change that will be released with @azure/[email protected], which has not yet been released, but is hopefully being released this week. In the meantime, you can try switching to the master branch and see if the sample works.
@patrick-robin Please switch to the master branch too. If you continue to encounter this, please open a new issue with our issue templates.
@jo-arroyo I've just taken a fresh checkout of the code and switched to the master branch but I get the same issue. I've just realised that I'm using the Angular11-sample-app, however I get the same issue if I try and run the B2C sample. I've opened a new issue for you,
`- Generating browser application bundles (phase: building)...
Error: src/app/home/home.component.ts:18:37 - error TS2339: Property 'setActiveAccount' does not exist on type 'IPublicClientApplication'.
18 this.authService.instance.setActiveAccount(result.account);
~~~~~~~~~~~~~~~~
src/app/app.component.ts:48:39 - error TS2339: Property 'setActiveAccount' does not exist on type 'IPublicClientApplication'.
48 this.authService.instance.setActiveAccount(response.account);
~~~~~~~~~~~~~~~~
src/app/app.component.ts:54:41 - error TS2339: Property 'setActiveAccount' does not exist on type 'IPublicClientApplication'.
54 this.authService.instance.setActiveAccount(response.account);
~~~~~~~~~~~~~~~~
src/app/app.module.ts:48:5 - error TS2322: Type '{ interactionType: InteractionType.Redirect; loginFailedRoute: string; }' is not assignable to type 'MsalGuardConfiguration'.
Object literal may only specify known properties, and 'loginFailedRoute' does not exist in type 'MsalGuardConfiguration'.
48 loginFailedRoute: '/login-failed'
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`
@jitendraP-ashutec The latest versions of msal-browser and msal-angular were released last night. Please update by npm install @azure/[email protected] @azure/msal-angular@alpha and give the new version a try.
That works, thanks.
Thanks @jo-arroyo .
Closing as @azure/[email protected] was released on 01/12/2021 and @azure/[email protected] was released on 01/21/2021.
Most helpful comment
@jitendraP-ashutec The latest versions of msal-browser and msal-angular were released last night. Please update by npm install @azure/[email protected] @azure/msal-angular@alpha and give the new version a try.