授权代码授予流程 [英] Authorization Code Grant Flow
问题描述
我一直在阅读有关使用OAuth进行身份验证的文档,我已经停止了有关身份验证代码的问题。
我能够然而,我不确定如何使用它来生成访问令牌和刷新令牌。
如果有人能够更好地解释这一步,我将非常感激。
提前致谢,
T
您首先需要通过浏览器授予同意,即步骤1-3 。
我希望这有帮助!
Eric
I've been going through the documentation regarding the Authentication with OAuth and I've come to a stop regarding the authentication code.
I am able to generate the authentication code however, I'm not sure on how to use this in order to generate an access token and refresh token.
If anyone could better explain this step I would really appreciate it.
Thanks in advance,
T
解决方案You'll first need to grant consent via the browser i.e., steps 1-3 of Authorization Code Grant Flow. Once you have the 'code' you can use it via Postman to get the access and refresh tokens as follows:
To refresh the token, update the grant type and use the refresh token from the previous call.
These examples are for sandbox OAuth i.e., login.live-int.com. For production MSA authentication, use login.live.com. Also note that if you set the content-length header as I did in the first example, it must be exact. You can omit content-length, as shown in the second example.
If you are using .NET, Java, or Python please also see Step 3 via SDK Authentication.
I hope this helps!
Eric
这篇关于授权代码授予流程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文