मैं वेब फॉर्म ऐप में Busines के लिए OneDrive को एकीकृत करने का प्रयास कर रहा हूं। इसके लिए मैं उपयोग कर रहा हूं प्रलेखन इस यूआरएल https://dev.onedrive.com/auth/aad_oauth.htm वेब प्रपत्र अनुप्रयोग में मैं दो पृष्ठ पहले एक लॉगिन है पृष्ठ लॉगिन बटन लॉगिन क्लिक में के लिए एक बटन है मैं निम्नलिखित कोड का उपयोग करव्यवसाय के लिए OneDrive: "invalid_request", "error_description": "AADSTS90014: अनुरोध निकाय में निम्न पैरामीटर होना चाहिए: 'grant_type
व्यापार एपीआई के लिए OneDrive में GET अनुरोध बनाने रहा है पर दियाHttpClient client = new HttpClient();
Redirecturi = Uri.EscapeDataString(Redirecturi);
string url = string.Format("https://login.windows.net/common/oauth2/authorize?response_type=code&client_id={0}&redirect_uri={1}", ClienId, Redirecturi);
var response = client.GetAsync(url);
var json = response.Result.Content.ReadAsStringAsync();
Label2.Text = json.Result;
जब मैं लॉगिन बटन पर क्लिक करता हूं तो यह मुझे micorosoft लॉगिन servie पर ले जा रहा है और मुझे वापस भेज रहा है एक्सेस कोड (रीडायरेक्ट उरी नीला पर कॉन्फ़िगर)
साथ पेज callback.aspx को मैं एक्सेस कोड दूसरे पृष्ठ पर मैं पहुँच कोड रिडीम कर रहा हूँ और प्रमाणीकरण टोकन यहाँ पाने के लिए एक पोस्ट अनुरोध बनाने के लिए मिल गया है कोड दूसरा पृष्ठ
private string BaseUri="https://login.windows.net/common/oauth2/token";
public string Redirecturi = "http://localhost:51642/CallBack.aspx";
public string ResourcesId = "https://api.office.com/discovery/";
private string ClienId = "180c6ac4-5829-468e-.....-822405804862"; ///truncated//azure
private string ClientSecert = "G4TAQzD8d7C4...OE6m366afv8XKbTCcyXr4=";//truncated
protected void Page_Load(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(Request.QueryString[OAuthConstants.AccessToken]))
{
// There is a token available already. It should be the token flow. Ignore it.
return;
}
if (!string.IsNullOrEmpty(Request.QueryString[OAuthConstants.Code]))
{
string _accessCode = Request.QueryString[OAuthConstants.Code];
HttpClient client = new HttpClient();
// BaseUri = Uri.EscapeDataString(BaseUri);
Redirecturi = Uri.EscapeDataString(Redirecturi);
ResourcesId = Uri.EscapeDataString(ResourcesId);
string url = string.Format("{0}?client_id={1}&redirect_uri={2}&grant_type=authorization_code&client_secret={3}&code={4}&grant_type=authorization_code&resource={5}", BaseUri, ClienId, Redirecturi, ClientSecert, _accessCode, ResourcesId);
var response = client.PostAsync(url, null);
var json = response.Result.Content.ReadAsStringAsync();
Response.Write(json);
}
}
लेकिन प्रतिक्रिया के बजाय मुझे निम्नलिखित त्रुटि मिल रही है। जिसमें यूआरएल में grant_type शामिल है। मैंने पहले ही जोड़ा है (आप कोड में जांच सकते हैं)। इसमें शामिल किए बिना मुझे भी एक ही त्रुटि मिल रही है।
यहाँ त्रुटि
{"error":"invalid_request","error_description":"AADSTS90014: The request body must contain the following parameter: 'grant_type'.\r\nTrace ID: 2adb3a7f-ceb1-4978-97c4-3dc2d3cc3ad4\r\nCorrelation ID: 29fb11a0-c602-4891-9299-b0b538d75b5f\r\nTimestamp: 2015-07-15 09:58:42Z","error_codes":[90014],"timestamp":"2015-07-15 09:58:42Z","trace_id":"2adb3a7f-ceb1-4978-97c4-3dc2d3cc3ad4","correlation_id":"29fb11a0-c602-4891-9299-b0b538d75b5f","submit_url":null,"context":null}
कृपया पता करने के लिए जहां, क्या गलत geting मदद है। किसी भी तरह की मदद की सराहना की जाएगी अग्रिम में बहुत कुछ
कभी यह पता लगा? क्योंकि मुझे जावा –