Oauth 2.0 (现在)可以通过API撤销Gitlab访问令牌吗?
两年前,有人问是否有可能。当时的答案是否定的。我没有找到最近证实或否定这一点的信息 我希望在Python的http请求库中使用类似的内容:Oauth 2.0 (现在)可以通过API撤销Gitlab访问令牌吗?,oauth-2.0,gitlab,revoke-token,Oauth 2.0,Gitlab,Revoke Token,两年前,有人问是否有可能。当时的答案是否定的。我没有找到最近证实或否定这一点的信息 我希望在Python的http请求库中使用类似的内容: headers = {'Authorization': clientSecret} res = gitlab.post("https://gitlab.com/oauth/revoke", headers=headers, data={ 'client_id': clientID, '
headers = {'Authorization': clientSecret}
res = gitlab.post("https://gitlab.com/oauth/revoke", headers=headers, data={
'client_id': clientID,
'access_token': accessToken
})
print(res.text)
但是,响应是空的,有不同的变化。根据信息,似乎完全可以撤销访问令牌。
这项工作:
payload = {"token": accessToken,
"token_type_hint": "refresh_token"
}
auth = HTTPBasicAuth(clientID, clientSecret)
res = requests.post("https://gitlab.com/oauth/revoke",
data=payload,
auth=auth,
)