惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

WordPress大学
WordPress大学
V
Visual Studio Blog
P
Privacy International News Feed
月光博客
月光博客
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
L
Lohrmann on Cybersecurity
N
News and Events Feed by Topic
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Apple Machine Learning Research
Apple Machine Learning Research
阮一峰的网络日志
阮一峰的网络日志
Webroot Blog
Webroot Blog
T
Threatpost
宝玉的分享
宝玉的分享
The Last Watchdog
The Last Watchdog
小众软件
小众软件
L
LINUX DO - 最新话题
C
Cisco Blogs
T
Troy Hunt's Blog
Schneier on Security
Schneier on Security
酷 壳 – CoolShell
酷 壳 – CoolShell
www.infosecurity-magazine.com
www.infosecurity-magazine.com
雷峰网
雷峰网
G
GRAHAM CLULEY
有赞技术团队
有赞技术团队
Know Your Adversary
Know Your Adversary
博客园 - 叶小钗
罗磊的独立博客
V
V2EX
博客园 - Franky
P
Proofpoint News Feed
SecWiki News
SecWiki News
腾讯CDC
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Jina AI
Jina AI
博客园 - 三生石上(FineUI控件)
S
Secure Thoughts
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Google DeepMind News
Google DeepMind News
Attack and Defense Labs
Attack and Defense Labs
人人都是产品经理
人人都是产品经理
The Cloudflare Blog
PCI Perspectives
PCI Perspectives
V2EX - 技术
V2EX - 技术
Google DeepMind News
Google DeepMind News
Last Week in AI
Last Week in AI
aimingoo的专栏
aimingoo的专栏
Cisco Talos Blog
Cisco Talos Blog
N
News and Events Feed by Topic
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
S
SegmentFault 最新的问题

OAuth

授权码 + PKCE 模式| OIDC & OAuth2.0 认证协议最佳实践系列 [03] - V2EX OIDC & OAuth2.0 协议及其授权模式详解|认证协议最佳实践系列 [1] - V2EX OIDC & OAuth2.0 认证协议最佳实践系列 02 - 授权码模式(Authorization Code)接入 Authing - V2EX Java 小小写个开源 OAuth 客户端工具 - V2EX 腾讯的网页授权真难申请,微博秒搞定! - V2EX 关于 native 应用程序在使用 OAuth 2.0 的一些问题 如何创建一个 OAuth 服务 - V2EX 在oauth1.0中签名的话必须有consumer_key 与consumer_secret ,这样的话在桌面应用中岂不是这两个都给暴漏了 OAuth.io - V2EX OAuth 2.0 - V2EX weibo的OAuth问题 - V2EX 搞定 OAuth 的感觉实在是太爽了 - V2EX img.ly API
腾讯微博的OAuth问题...... - V2EX
fanzeyi · 2011-07-27 · via OAuth
laiwei

26

laiwei      2012 年 2 月 23 日

@fanzeyi @joyqi

我发现腾讯微博oauth签名的真正问题了
并不是urllib或者httplib的问题

而是计算basestring的计算方法有问题:

比如待签名的东西参数有:
d = {
oauth_callback : xxxx.com/sth
oauth_consumer_key : 123456
oauth_nonce : 33333
oauth_signature_method : HMAC-SHA1
oauth_timestamp : 1234455667777
oauth_version : 1.0

}

首先把d按照key做一下sort
d = sorted(d.items(), key=lambda x:x[0])

其次,把参数和参数的值都做urlencode
dd = [urllib.urlencode([x]) for x in d]

然后,把dd用&符号连接起来,再做一次urlencode(也就是quote)
part3 = urllib.quote("&".join(dd))

这里的关键就是说,这些参数前前后后,被quote了两次!

这样做,就ok了