Topic
The following steps will allow you get a access token for use with the Nintex Forms SPFx API’s when MFA is required.
Instructions
- Obtain the Microsoft.Identity.Client.dll from the NGet package, by extracting it from the downloaded package lib\<net6.0 or net472>\Microsoft.Identity.Client.dll.
- In the Entra ID app, under the Authentication, add a new Redirect URIs :
- Platforms: Mobile and desktop applications
- Custom redirect URIs: http://localhost
- In the same directory of the dll, execute this powershell script:
Add-Type -Path ".\Microsoft.Identity.Client.dll"
$ClientId = "<Client ID>"
$TenantId = "<Tenant ID>"
$RedirectUri = "http://localhost"
[string[]] $Scopes = 'https://<tenant>.sharepoint.com/.default'
$App = [Microsoft.Identity.Client.PublicClientApplicationBuilder]::Create($ClientId).
WithAuthority("https://login.microsoftonline.com/$TenantId/v2.0").
WithRedirectUri($RedirectUri).
Build()
$Result = $App.AcquireTokenInteractive($Scopes).ExecuteAsync().GetAwaiter().GetResult()
$Result.AccessToken