Box API always returns invalid grant_type parameter on obtaining access token

后端 未结 4 1218
北海茫月
北海茫月 2020-12-21 23:26

I\'m writing my own Box SDK for WP8 to make the most out of Tasks. I am having trouble obtaining an access token. I always get this as a return:

{\"error\":\         


        
4条回答
  •  星月不相逢
    2020-12-22 00:26

    in Windows phone 8.1 WinRT

    Dictionary contentList = new Dictionary();
    
    contentList.Add("code", code);
    contentList.Add("client_id", client_id);
    contentList.Add("client_secret", clientSecret);
    contentList.Add("redirect_uri", redirectUri);
    contentList.Add("grant_type", "authorization_code");
    
    FormUrlEncodedContent content = new FormUrlEncodedContent(contentList);
    
    var response = await client.PostAsync(baseURL, content);
    YouTubeAutenticationResponse res =       JsonConvert.DeserializeObject(await     response.Content.ReadAsStringAsync());
    
    public class YouTubeAutenticationResponse
    {
        [JsonProperty("access_token")]
        public string AccessToken { get; set; }
        [JsonProperty("token_type")]
        public string TokenType { get; set; }
        [JsonProperty("expires_in")]
        public string ExpiresIn { get; set; }
        [JsonProperty("refresh_token")]
        public string RefreshToken { get; set; }
    }
    

提交回复
热议问题