OAuth2:使用Gitee第三方授权

gitee OAuth2文档

1. 配置授权页url

传入client_id(创建应用获得)、redirect_uri(需要通过第三方授权跳转的url)

https://gitee.com/oauth/authorize?client_id={
    
    client_id}&redirect_uri={
    
    redirect_uri}&response_type=code

2. 进入授权页,获取url中的code码

在这里插入图片描述

3. 发送Post请求获取token

传入上一步获取的code码,client_id,redirect_uri,client_secret

https://gitee.com/oauth/token?grant_type=authorization_code&code={
    
    code}&client_id={
    
    client_id}&redirect_uri={
    
    redirect_uri}&client_secret={
    
    client_secret}

在这里插入图片描述

4. 使用token 获取用户信息

在这里插入图片描述
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_44847885/article/details/131341706