[英]How to get AccessToken
I am building a client and need help getting the access token.我正在构建一个客户端,需要帮助来获取访问令牌。
would like to know what needs to be passed in grant_type?想知道在grant_type 中需要传递什么? client_assertion?客户断言? Where to get these values from?从哪里获得这些值? as these values are required in Authentication in providing AccessToken因为在提供 AccessToken 的身份验证中需要这些值
POST /token HTTP/1.1 Host: :443 Timestamp: 1212669235 Date: Fri, 12 May 2016 17:21:16 GMT+0000 Content-type: application/x-www-form-urlencoded POST /token HTTP/1.1 主机::443 时间戳:1212669235 日期:2016 年 5 月 12 日星期五 17:21:16 GMT+0000 内容类型:application/x-www-form-urlencoded
grant_type=client_credentials&client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer&scope=profile-search&client_assertion=<JSON Web Signature (JWS)> grant_type=client_credentials&client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer&scope=profile-search&client_assertion=<JSON Web 签名 (JWS)
HTTP/1.1 200 OK Content-Type: application/json;charset=UTF-8 Content-Length: 653 Date: Tue, 29 Oct 2019 14:13:29 GMT { "access_token": "KjdsjEeRFwksjqefindikHAfDKV...", "token_type": "bearer" "expires_in": 3600 "scope":"profile-search" } HTTP/1.1 200 OK 内容类型:application/json;charset=UTF-8 内容长度:653 日期:2019 年 10 月 29 日星期二 14:13:29 GMT { "access_token": "KjdsjEeRFwksjqefindikHAfDKV...", "token_type ": "bearer" "expires_in": 3600 "scope":"profile-search" }
To get the token for Client Credentials type OAuth mechanism, following parameters are needed:要获取客户端凭据类型 OAuth 机制的令牌,需要以下参数:
grant_type = client credentials
Access Token URL = <the Auth server URL token end point>
ClientId = <the Id from the auth server where app is registered>
ClientSecret = <value for the secret set>
Scope = <scope as defined for the application>
Attaching the screenshot from Postman for a sample application to generate the token for this grant type.附上来自 Postman 的屏幕截图,用于生成此授权类型的令牌的示例应用程序。
More details for it can be referenced from: https://www.oauth.com/oauth2-servers/access-tokens/client-credentials/更多细节可以参考: https://www.oauth.com/oauth2-servers/access-tokens/client-credentials/
Sample for this from Azure AD set up is here: https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-client-creds-grant-flow Azure AD 设置的示例在这里: https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-client-creds-grant-flow
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.