Oauth1.0a授权流程小记

Oauth 1.0a 用户授权流程图如下:


A,向服务器端请求未授权的request token

oauth_consumer_key(开发者申请的$appkey)

oauth_signature_method (HMAC-SHA1,RSA-SHA!,PLAINTEXT)

oauth_signature(base64_encode(hash_hmac('sha1', $base_string, $key, true)))

//其中$key为$appsecret."&"(Oauth标准9.2节)

//其中$base_string=(GET|POST|HEAD)."&".urlencode((request uri query string excluded))."&".urlencode(($k."=".urlencode($v)."&")..)

//1,http请求方法名大写;2,请求的baseurl不含参数后urlencode;3,

oauth_timestamp(时间戳)

oauth_nonce(任意随机字符串,不可重复)

oauth_version(optional)

others...

B,服务器返回未授权request token

oauth_token

oauth_token_secret(用于E步骤计算oauth_signature)

oauth_callback_confirmed(true)

C,引导用户去资源存储网站的授权页

oauth_token

D,授权成功,返回授权后的request token

oauth_token(和B步骤返回的oauth_token一样)

oauth_verifier(用于E中换取access token)

E,使用request token换取access token

oauth_consumer_key

oauth_token

oauth_signature_method

oauth_signature(base64_encode(hash_hmac('sha1', $base_string, $key, true)))

//其中$key=$appsecret."&".$token_secret(Oauth标准9.2节)

oauth_timestamp

oauth_nonce

oauth_version(optional)

oauth_verifier

others...

F,返回access token与access token secret

oauth_token(用于受限资源访问)

oauth_token_secret

G,使用access token与access token获取受限资源

oauth_consumer_key

oauth_token

oauth_signature_method

oauth_signature

oauth_timestamp

oauth_nonce

oauth_version(optional)

others...

Oauth规范中把request token以及access token都称作oauth token,上面为了区分就没有统一说明

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值