Replies: 1 comment
-
We have full MFA support in PnP PowerShell nowadays, if that helps. You can use the -Interactive switch for that. If you have your own app registered, use both -Interactive and -ClientId [yourid]: Connect-PnPOnline -Url <String> -Interactve [-ClientId <String>]
$ClientContext = Get-PnPContext If you want to use the AuthenticationManager directly you can find it in PnP.Framework.AuthenticationManager. However, it's use and approach has heavily changed: we standardize now fully on MSAL and the constructors and methods have changed. The Authentication Manager will fully handle refreshing tokens after expiration etc. so if you retrieve a client context use the AuthenticationManager class for that as it will hook up the required backend code to retrieve a new token if required. Caching of the token is handled in-memory, but you can override that use and provide your own token cache if you want to. Check out the source code at https://github.com/pnp/pnpframework/blob/dev/src/lib/PnP.Framework/AuthenticationManager.cs where we show the new methods. How we use the authentication manager in PnP PS can be found at https://github.com/pnp/powershell/blob/dev/src/Commands/Base/PnPConnectionHelper.cs |
Beta Was this translation helpful? Give feedback.
-
Hi!
I use $authManager = new-object OfficeDevPnP.Core.AuthenticationManager in PowerShell to authenticate with MFA against SharePoint Online. After upgrade from module SharePointPnPPowerShellOnline to PnP.PowerShell I can't find method AuthenticationManager anymore. Could you please help how to use it now?
BR
sp00ky
Beta Was this translation helpful? Give feedback.
All reactions