問題タブ [blazor]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票する
3 に答える
6307 参照

c# - Blazor を使用して JWT が ASP.NET Core に格納されない

このチュートリアルに従いました: https://medium.com/@st.mas29/microsoft-blazor-web-api-with-jwt-authentication-part-1-f33a44abab9d

サンプルをダウンロードしました: https://github.com/StuwiiDev/DotnetCoreJwtAuthentication/tree/Part2

トークンが作成されたことはわかりますが、タグSampleDataControllerを持つにアクセスするたびに 401 が返されるため、クライアント側でトークンをどのように保存するか、または保存する必要があるかがわかりません。Authorize

Postman を使用してトークンを呼び出して追加すると、機能します。

ユーザーが認証されるために何が欠けていますか? Microsoft.AspNetCore.Authentication.JwtBearerクライアント部分 (トークンの保存) を処理しませんか?