有效的訪問令牌仍然獲得401

2022-07-03 15:24:09 字數 2134 閱讀 3964

我在react中有乙個客戶端應用程式,它使用auth0正確驗證,收到的訪問令牌有效幷包含適當的受眾(使用auth0證書驗證了jwt.io 4中 的令牌)。伺服器正在註冊乙個令牌驗證事件,然後是乙個訊息,authenticationscheme: bearer was challenged.並在401返回後不久。伺服器也正確配置了適當的域和受眾。http請求包含authorization帶有bearer方案的標頭

解碼的jwt有效載荷(有一些替代品):

請求的伺服器日誌:

authorization failed

for user: (null

).microsoft.aspnetcore.authorization.defaultauthorizationservice:information: authorization failed

for user: (null

).info: microsoft.aspnetcore.mvc.internal.controlleractioninvoker[3]

authorization failed

for the request at filter '

microsoft.aspnetcore.mvc.authorization.authorizefilter'.

microsoft.aspnetcore.mvc.internal.controlleractioninvoker:information: authorization failed

for the request at filter '

microsoft.aspnetcore.mvc.authorization.authorizefilter'.

info: microsoft.aspnetcore.mvc.challengeresult[1]

executing challengeresult with authentication schemes ().

microsoft.aspnetcore.mvc.challengeresult:information: executing challengeresult with authentication schemes ().

info: microsoft.aspnetcore.authentication.jwtbearer.jwtbearerhandler[2]

successfully validated the token.

microsoft.aspnetcore.authentication.jwtbearer.jwtbearerhandler:information: successfully validated the token.

info: microsoft.aspnetcore.authentication.jwtbearer.jwtbearerhandler[12]

authenticationscheme: bearer was challenged.

microsoft.aspnetcore.authentication.jwtbearer.jwtbearerhandler:information: authenticationscheme: bearer was challenged.

info: microsoft.aspnetcore.mvc.internal.controlleractioninvoker[2]

23.2551ms

23.2551ms

info: microsoft.aspnetcore.hosting.internal.webhost[2]

=> requestid:0hl8gqm6g7e9t:00000001 requestpath:/api/1.0/things

request finished

in31.3853ms 401

microsoft.aspnetcore.hosting.internal.webhost:information: request finished

in31.3853ms 401

the thread

4456 has exited with code 0 (0x0).

必須在mvc之前設定身份驗證的中介軟體。

Golang模擬令牌桶進行對訪問的限流方式

func fw max int,duration time.duration for 補充 golang簡易令牌桶演算法實現 定義乙個chan,chan大小為需要限制的qps大小,go乙個協程啟動tick,每1000 qps時間在tick中寫入數值,啟動另乙個協程,讀取chan中的值,如果讀取到ch...

程式設計的有效方法 例項變數的訪問

1 為什麼寫這篇微博 在物件外部訪問例項變數時,通過屬性來作,而在物件內部訪問例項變數,是應該直接訪問還是通過屬性訪問,一直存在著很大爭議。要想解決這一問題,必須明白這兩者實現方式的區別 2 二者實現方式的區別 通過直接訪問的形式不經過oc的 方法派發 以後會深入 的步驟,訪問的速度較快一些。這種方...

DOM 01 DOM訪問關係 節點的獲得

父節點 兄弟節點 單個節點 ie指的是ie 6 7 8 1 獲取父節點 element.parentnode 2 獲取兄弟點 2.1獲取上乙個兄弟節點 ie element.nextsibling 其他 element.previouselementsibing 總結 var prev elemen...