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

推荐订阅源

S
Secure Thoughts
Security Latest
Security Latest
Simon Willison's Weblog
Simon Willison's Weblog
O
OpenAI News
GbyAI
GbyAI
L
LINUX DO - 最新话题
A
Arctic Wolf
T
Tor Project blog
G
GRAHAM CLULEY
I
InfoQ
博客园_首页
IT之家
IT之家
The Register - Security
The Register - Security
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
P
Proofpoint News Feed
The GitHub Blog
The GitHub Blog
Blog — PlanetScale
Blog — PlanetScale
N
Netflix TechBlog - Medium
K
Kaspersky official blog
博客园 - 三生石上(FineUI控件)
S
SegmentFault 最新的问题
U
Unit 42
PCI Perspectives
PCI Perspectives
量子位
P
Palo Alto Networks Blog
S
Securelist
T
Troy Hunt's Blog
博客园 - 【当耐特】
Recorded Future
Recorded Future
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
S
Security Affairs
Engineering at Meta
Engineering at Meta
T
The Blog of Author Tim Ferriss
博客园 - 聂微东
罗磊的独立博客
N
News and Events Feed by Topic
人人都是产品经理
人人都是产品经理
B
Blog RSS Feed
NISL@THU
NISL@THU
C
Cisco Blogs
T
Threatpost
有赞技术团队
有赞技术团队
Forbes - Security
Forbes - Security
Hugging Face - Blog
Hugging Face - Blog
Last Week in AI
Last Week in AI
T
The Exploit Database - CXSecurity.com
Cloudbric
Cloudbric
Cyberwarzone
Cyberwarzone
Google DeepMind News
Google DeepMind News
C
Cyber Attacks, Cyber Crime and Cyber Security

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了