Jwt访问api提示401错误 Authorization has been denied for this request

教程  http://bitoftech.net/2015/02/16/implement-oauth-json-web-tokens-authentication-in-asp-net-web-api-and-identity-2/   

源码  https://github.com/ChuckTest/AspNetWebApi2/

对应到commit的编号25df01a25c0aa8cada67474c3788272cace428db

 

 

发现是忘记step 6了

Step 6: Consume JSON Web Tokens

Now if we tried to obtain an access token by sending a request to the end point “oauth/token” then try to access one of the protected end points we’ll receive 401 Unauthorized status, the reason for this that our API doesn’t understand those JWT tokens issued by our API yet, to fix this we need to the following:

 

 

 

 

 

 

Stack Overflow上的一个提问https://stackoverflow.com/questions/26458785/i-get-authorization-has-been-denied-for-this-request-error-message-when-using

里面提到了另外一个教程http://bitoftech.net/2014/09/24/decouple-owin-authorization-server-resource-server-oauth-2-0-web-api/  关于如何解耦授权服务器和资源服务器的

作者:Chuck Lu    GitHub    
posted @   ChuckLu  阅读(2803)  评论(0编辑  收藏  举报
编辑推荐:
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· DeepSeek 开源周回顾「GitHub 热点速览」
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
历史上的今天:
2016-02-19 svn版本库包含多个项目 ; git svn clone; 某一个子项目,有多个分支;
2016-02-19 Using Git subtrees to split a repository
2016-02-19 guidelines for contributing Hearthstone-Deck-Tracker
2014-02-19 FieldOffset
2014-02-19 关于指针的解释
点击右上角即可分享
微信分享提示