http://open.weibo.com/wiki/Oauth2/authorize 新浪登录接口

Oauth2/authorize

oauth2/authorize

OAuth2的authorize接口

URL

https://api.weibo.com/oauth2/authorize

HTTP请求方式

GET/POST

请求参数

  必选 类型及范围 说明
client_id true string 申请应用时分配的AppKey。
redirect_uri true string 授权回调地址,站外应用需与设置的回调地址一致,站内应用需填写canvas page的地址。
scope false string 申请scope权限所需参数,可一次申请多个scope权限,用逗号分隔。使用文档
state false string 用于保持请求和回调的状态,在回调时,会在Query Parameter中回传该参数。开发者可以用这个参数验证请求有效性,也可以记录用户请求授权页前的位置。这个参数可用于防止跨站请求伪造(CSRF)攻击
display false string 授权页面的终端类型,取值见下面的说明。
forcelogin false boolean 是否强制用户重新登录,true:是,false:否。默认false。
language false string 授权页语言,缺省为中文简体版,en为英文版。英文版测试中,开发者任何意见可反馈至 @微博API


display说明:
参数取值 类型说明
default 默认的授权页面,适用于web浏览器。
mobile 移动终端的授权页面,适用于支持html5的手机。注:使用此版授权页请用https://open.weibo.cn/oauth2/authorize 授权接口
wap wap版授权页面,适用于非智能手机。
client 客户端版本授权页面,适用于PC桌面应用。
apponweibo 默认的站内应用授权页,授权后不返回access_token,只刷新站内应用父框架。

返回数据

返回值字段 字段类型 字段说明
code string 用于调用access_token,接口获取授权后的access token。
state string 如果传递参数,会回传该参数。

示例

//请求
https://api.weibo.com/oauth2/authorize?client_id=123050457758183&redirect_uri=http://www.example.com/response&response_type=code

//同意授权后会重定向
http://www.example.com/response&code=CODE

要使用token验证身份,你可以按照以下步骤进行操作: 1. 首先,你需要通过OAuth2授权流程获取到一个授权码(code)。你可以使用以下链接进行授权: \[https://accounts.google.com/o/oauth2/auth?scope=https://www.googleapis.com/auth/androidpublisher&response_type=code&access_type=offline&redirect_uri=http://localhost&client_id=client_id\](https://accounts.google.com/o/oauth2/auth?scope=https://www.googleapis.com/auth/androidpublisher&response_type=code&access_type=offline&redirect_uri=http://localhost&client_id=client_id) \[1\] 2. 使用获取到的授权码(code),通过POST请求获取到一个刷新令牌(refresh_token)。你可以使用以下链接进行POST请求: \[https://accounts.google.com/o/oauth2/token?grant_type=authorization_code&code=浏览器地址栏的code&client_id=OAuth的id编号&client_secret=OAuth的密钥(id编号下面那个)&redirect_uri=http://localhost(刚刚新增的URL)\](https://accounts.google.com/o/oauth2/token?grant_type=authorization_code&code=浏览器地址栏的code&client_id=OAuth的id编号&client_secret=OAuth的密钥(id编号下面那个)&redirect_uri=http://localhost(刚刚新增的URL)) \[2\] 3. 最后,你可以使用获取到的刷新令牌(refresh_token)来进行身份验证。你可以使用以下链接进行身份验证: \[https://accounts.google.com/o/oauth2/v2/auth?scope=https://mail.google.com/&access_type=offline&redirect_uri=http://localhost&response_type=code&client_id=\[your_client_id\]\](https://accounts.google.com/o/oauth2/v2/auth?scope=https://mail.google.com/&access_type=offline&redirect_uri=http://localhost&response_type=code&client_id=\[your_client_id\]) \[3\] 请注意,上述链接中的一些参数需要你根据实际情况进行替换,比如client_id和code等。另外,这些链接是示例链接,你需要根据你的具体需求进行相应的修改。 #### 引用[.reference_title] - *1* *2* [谷歌支付获取refresh token](https://blog.csdn.net/wuyadafeiji/article/details/127886603)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item] - *3* [Google Gmail Oauth Client ID 认证指南](https://blog.csdn.net/hantangduhey/article/details/126704183)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值