简体   繁体   中英

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.
I want to apply OAuth with Azure as identity provider.
What I want is to use this single Web API that both of the applications calling, not to create separate APIs for each.

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".

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM