M
M
mindgrow2018-04-04 10:42:38
API
mindgrow, 2018-04-04 10:42:38

Instagram: Why does a 400 BadRequest occur when getting an access_token?

Good afternoon!
When an Access_token is requested, a BadRequest occurs.
How to fix it?

var body = new List<KeyValuePair<string, string>>
                {
                    new KeyValuePair<string, string>("grant_type", "authorization_code"),
                    new KeyValuePair<string, string>("code", code),
                    new KeyValuePair<string, string>("redirect_uri", redirectUri),
                    new KeyValuePair<string, string>("client_id", Options.ClientId),
                    new KeyValuePair<string, string>("client_secret", Options.ClientSecret)
                };

// Request the token
                var tokenResponse =
                    await _httpClient.PostAsync(TokenEndpoint, new FormUrlEncodedContent(body));

You can see the full code: https://github.com/TerribleDev/OwinOAuthProviders/...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
mindgrow, 2018-04-04
@mindgrow

Issue resolved.
I had a space at the end of the ClientSecret string

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question