[英]How to authenticate different type of applications using OAuth and one WebAPI
I have a WPF client application and AngularJs client connecting to the same Web API to get\\send data.我有一个 WPF 客户端应用程序和 AngularJs 客户端连接到同一个 Web API 来获取\\发送数据。
I want to apply OAuth with Azure as identity provider.我想将 OAuth 与 Azure 作为身份提供者一起应用。
What I want is to use this single Web API that both of the applications calling, not to create separate APIs for each.我想要的是使用这两个应用程序调用的单个 Web API,而不是为每个应用程序创建单独的 API。
Thanks谢谢
I found a solution,我找到了解决办法,
When you want to authenticate SPA app & WPF and both of them using the same WebAPI you'll face a problem, that in SPA case (see this sample ), in the server side (WebAPI) in the Startup.ConfigureAuth you need to set Audience property same as ClientId, but when you need to apply OAuth with WPF (native client, see this sample ) you'll need to provide it as "App ID URI".当您想验证 SPA 应用程序和 WPF 并且它们都使用相同的 WebAPI 时,您将面临一个问题,即在 SPA 情况下(请参阅此示例),在服务器端 (WebAPI) 中的Startup.ConfigureAuth您需要设置Audience 属性与 ClientId 相同,但是当您需要使用 WPF(本机客户端,请参阅此示例)应用 OAuth 时,您需要将其提供为“App ID URI”。
You solve this by adding the code from the first sample and the code from the second both in your Startup.ConfigureAuth method in your project.您可以通过在项目的Startup.ConfigureAuth方法中添加第一个示例中的代码和第二个示例中的代码来解决此问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.