久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

為令牌調(diào)用 Microsoft Graph API 會(huì)出現(xiàn)錯(cuò)誤“AADSTS9

Calling an Microsoft Graph API for token gives error quot;AADSTS900144: The request body must contain the following parameter: #39;grant_type#39;(為令牌調(diào)用 Microsoft Graph API 會(huì)出現(xiàn)錯(cuò)誤“AADSTS900144:請(qǐng)求正文必須包含以下
本文介紹了為令牌調(diào)用 Microsoft Graph API 會(huì)出現(xiàn)錯(cuò)誤“AADSTS900144:請(qǐng)求正文必須包含以下參數(shù):“grant_type"的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

問(wèn)題描述

限時(shí)送ChatGPT賬號(hào)..

我正在調(diào)用 Graph API URL

https://login.microsoftonline.com/{tenantId}/oauth2/v2.0/token

獲取訪問(wèn)令牌,但我收到以下響應(yīng).

<代碼>{錯(cuò)誤":無(wú)效請(qǐng)求","error_description": "AADSTS900144: 請(qǐng)求正文必須包含以下參數(shù):'grant_type'.
跟蹤 ID: 5ff6b053-9011-4397-89ff-fdb6f31e4600
相關(guān) ID: 22509847-199d-4bd8-a083-b29d8bbf3139
時(shí)間戳:2020-04-01 11:14:00Z",錯(cuò)誤代碼":[900144],"時(shí)間戳": "2020-04-01 11:14:00Z",trace_id":5ff6b053-9011-4397-89ff-fdb6f31e4600",correlation_id":22509847-199d-4bd8-a083-b29d8bbf3139",error_uri":https://login.microsoftonline.com/error?code=900144"}

我有一個(gè)活動(dòng)的租戶 ID,我有一個(gè)注冊(cè)的應(yīng)用程序,并且我有一個(gè)上述應(yīng)用程序的活動(dòng)用戶說(shuō) user@tenant.onmicrosoft.com;該用戶具有所有角色(全局管理員).

請(qǐng)?jiān)谙路秸业?Postman 的請(qǐng)求和響應(yīng).

解決方案:

你在嘗試錯(cuò)誤的方式.您必須使用 key-value 對(duì) 在郵遞員的 form-data 中發(fā)送所需的參數(shù),格式如下:

grant_type:client_credentialsclient_id:b6695c7be_YourClient_Id_e6921e61f659client_secret:Vxf1SluKbgu4PF0Nf_Your_Secret_Yp8ns4sc=范圍:https://graph.microsoft.com/.default

代碼片段:

//令牌請(qǐng)求端點(diǎn)字符串 tokenUrl = $"https://login.microsoftonline.com/YourTenant.onmicrosoft.com/oauth2/v2.0/token";var tokenRequest = new HttpRequestMessage(HttpMethod.Post, tokenUrl);//我正在使用 client_credentials 作為它主要推薦tokenRequest.Content = new FormUrlEncodedContent(new Dictionary<string, string>{["grant_type"] = "client_credentials",["client_id"] = "b6695c7be_YourClient_Id_e6921e61f659",["client_secret"] = "Vxf1SluKbgu4PF0Nf_Your_Secret_Yp8ns4sc=",["范圍"] = "https://graph.microsoft.com/.default"});動(dòng)態(tài)json;AccessTokenClass 結(jié)果 = new AccessTokenClass();HttpClient 客戶端 = 新 HttpClient();var tokenResponse = await client.SendAsync(tokenRequest);json = 等待 tokenResponse.Content.ReadAsStringAsync();結(jié)果 = JsonConvert.DeserializeObject(json);

使用的類:

公共類AccessTokenClass{公共字符串 token_type { 獲取;放;}公共字符串 expires_in { 獲取;放;}公共字符串資源 { 獲取;放;}公共字符串 access_token { 獲取;放;}}

您可以參考 官方文檔

希望這會(huì)有所幫助.如果您仍有任何疑慮,請(qǐng)隨時(shí)分享.

I am calling a Graph API URL

https://login.microsoftonline.com/{tenantId}/oauth2/v2.0/token

to get an access token but I am getting the following response.

{
    "error": "invalid_request",
    "error_description": "AADSTS900144: The request body must contain the following parameter: 'grant_type'.
Trace ID: 5ff6b053-9011-4397-89ff-fdb6f31e4600
Correlation ID: 22509847-199d-4bd8-a083-b29d8bbf3139
Timestamp: 2020-04-01 11:14:00Z",
    "error_codes": [
        900144
    ],
    "timestamp": "2020-04-01 11:14:00Z",
    "trace_id": "5ff6b053-9011-4397-89ff-fdb6f31e4600",
    "correlation_id": "22509847-199d-4bd8-a083-b29d8bbf3139",
    "error_uri": "https://login.microsoftonline.com/error?code=900144"
}

I have an active tenantid, I have an application registered, and I have an active user for the above application say user@tenant.onmicrosoft.com; that user has ALL the roles (Global Administrator).

Please find below Postman's request and Response. PostmanSnap

Also I have given API permission as suggested in https://docs.microsoft.com/en-us/graph/api/group-post-members?view=graph-rest-1.0&tabs=http

解決方案

Problem: I have successfully reproduced your error. As you seen below:

Solution:

You are trying in wrong way. You have to send required parameter in form-data on postman with key-value pairs like below format:

grant_type:client_credentials
client_id:b6695c7be_YourClient_Id_e6921e61f659
client_secret:Vxf1SluKbgu4PF0Nf_Your_Secret_Yp8ns4sc=
scope:https://graph.microsoft.com/.default

Code Snippet:

  //Token Request End Point
    string tokenUrl = $"https://login.microsoftonline.com/YourTenant.onmicrosoft.com/oauth2/v2.0/token";
    var tokenRequest = new HttpRequestMessage(HttpMethod.Post, tokenUrl);

    //I am Using client_credentials as It is mostly recommended
    tokenRequest.Content = new FormUrlEncodedContent(new Dictionary<string, string>
    {
        ["grant_type"] = "client_credentials",
        ["client_id"] = "b6695c7be_YourClient_Id_e6921e61f659",
        ["client_secret"] = "Vxf1SluKbgu4PF0Nf_Your_Secret_Yp8ns4sc=",
        ["scope"] = "https://graph.microsoft.com/.default" 
    });

    dynamic json;
    AccessTokenClass results = new AccessTokenClass();
    HttpClient client = new HttpClient();

    var tokenResponse = await client.SendAsync(tokenRequest);

    json = await tokenResponse.Content.ReadAsStringAsync();
    results = JsonConvert.DeserializeObject<AccessTokenClass>(json);

Class Used:

public class AccessTokenClass
   {
        public string token_type { get; set; }
        public string expires_in { get; set; }
        public string resource { get; set; }
        public string access_token { get; set; }
   }

You could refer to Official document

Hope that would help. If you still have any concern feel free to share.

這篇關(guān)于為令牌調(diào)用 Microsoft Graph API 會(huì)出現(xiàn)錯(cuò)誤“AADSTS900144:請(qǐng)求正文必須包含以下參數(shù):“grant_type"的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來(lái)源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問(wèn)題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

ASP.NET Core authenticating with Azure Active Directory and persisting custom Claims across requests(ASP.NET Core 使用 Azure Active Directory 進(jìn)行身份驗(yàn)證并跨請(qǐng)求保留自定義聲明)
ASP.NET Core 2.0 Web API Azure Ad v2 Token Authorization not working(ASP.NET Core 2.0 Web API Azure Ad v2 令牌授權(quán)不起作用)
How do I get Azure AD OAuth2 Access Token and Refresh token for Daemon or Server to C# ASP.NET Web API(如何獲取守護(hù)進(jìn)程或服務(wù)器到 C# ASP.NET Web API 的 Azure AD OAuth2 訪問(wèn)令牌和刷新令牌) - IT屋-程序員軟件開發(fā)技
Azure KeyVault Active Directory AcquireTokenAsync timeout when called asynchronously(異步調(diào)用時(shí) Azure KeyVault Active Directory AcquireTokenAsync 超時(shí))
Getting access token using email address and app password from oauth2/token(使用電子郵件地址和應(yīng)用程序密碼從 oauth2/token 獲取訪問(wèn)令牌)
New Azure AD application doesn#39;t work until updated through management portal(新的 Azure AD 應(yīng)用程序在通過(guò)管理門戶更新之前無(wú)法運(yùn)行)
主站蜘蛛池模板: av片免费观看 | 黄色a视频 | 日韩欧美中文字幕在线观看 | 国产精品1区2区 | 女子spa高潮呻吟抽搐 | 国产性色av | 日本一级黄色 | 亚洲视频一区二区 | 欧美在线免费观看视频 | 免费视频a | 国产高清免费视频 | 欧美一级欧美三级 | 天天操天天舔 | 久草福利在线观看 | 国产视频在线看 | 天天干天天弄 | 天天看天天干 | 99久久久国产精品 | 黄色录像大片 | 欧美成人综合 | 国产精品成人一区二区网站软件 | 免费一级a毛片 | 国产传媒一区二区 | 一区二区三区在线免费观看 | 欧美久久久| 亚洲区视频 | 毛片av在线| 中文字幕99 | 欧美8888| 国产一区二区三区在线视频 | 夜夜草av| 亚洲不卡 | 国产蜜臀av | 麻豆影音 | 美女无遮挡网站 | 日韩久久久 | 欧美一区二区免费 | 亚洲精品视频免费观看 | 欧美亚洲三级 | 天天干天天色 | 免费看成人片 |