2017-04-26 70 views
1

當您使用VS 2017創建新的Web API並選擇使用「工作或學校帳戶」進行身份驗證時,您將獲得使用JwtBearerAuthentication庫的代碼。也可以手動編寫Web API以使用OpenIdConnectAuthentication庫。使用這些的主要區別是什麼?需要根據API(服務器)端使用的庫,或者客戶端是否可以兼容保護API的兩種方式來爲客戶端編寫特定/不同的代碼?UseJwtBearerAuthentication與UseOpenIdConnectAuthentication?

+0

請參閱http://stackoverflow.com/questions/1087031/whats-the-difference-between-openid-and-oauth和https://security.stackexchange.com/questions/37818/why-use-openid -connect-instead-of-plain-oauth – abatishchev

回答

0

我試圖使用「工作或學校帳戶」生成ASP.NET核心Web應用程序,生成的代碼包含UseOpenIdConnectAuthentication。然後我在web apoplication中實現了一些代碼,用不記名令牌調用We​​b API,並且一切正常。

+0

你實現了什麼代碼來讓WebApi使用令牌? – Castrohenge

+1

我使用了VS 2017的標準ASP.NET MVC網頁模板,並選擇了更改身份驗證到「工作或學校帳戶」。 – OlavT

相關問題