0

我正在尝试使用 MIP SDK 设置标签。但是,在执行 AddEngineAsync 时,我收到拒绝访问错误。我能够从 AAD APP 获取访问令牌。任何帮助都会很棒。

代码:

var engine = Task.Run(async () => await profile.AddEngineAsync(engineSettings)).Result;

错误:

Unhandled Exception: System.AggregateException: One or more errors occurred. ---> Microsoft.InformationProtection.Exceptions.AccessDeniedException: The service didn't accept the auth token. Challenge:['']
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at MipSdkDotNetQuickstart.Action.<>c__DisplayClass10_0.<<CreateFileEngine>b__0>d.MoveNext() in C:\Users\wb561362\Mip_ServicePrincipalAuth\mip-sdk-dotnet-file-SPA\Action.cs:line 178
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at MipSdkDotNetQuickstart.Action.CreateFileEngine(Identity identity) in C:\Users\wb561362\Mip_ServicePrincipalAuth\mip-sdk-dotnet-file-SPA\Action.cs:line 178
   at MipSdkDotNetQuickstart.Action..ctor(ApplicationInfo appInfo) in C:\Users\wb561362\Mip_ServicePrincipalAuth\mip-sdk-dotnet-file-SPA\Action.cs:line 113
   at MipSdkDotNetQuickstart.Program.Main(String[] args)

以下是我们拥有的访问权限 在此处输入图像描述

4

1 回答 1

1

您应该验证您是否获得了正确资源的令牌。通常,当人们在他们的授权委托实现中硬编码或不正确地处理授权挑战时,我们会看到这个错误。

确保您没有对资源进行硬编码,并且将作为参数提供给 AcquireToken() 的资源传递给 MSAL 或 ADAL 实现。

于 2020-10-23T18:22:57.263 回答