ecnepsnai
ecnepsnai

Reputation: 2026

invalid_request error when getting access token

I'm trying to get my access token for my application, using this URL:

https://datamarket.accesscontrol.windows.net/v2/OAuth2-13?grant_type=client_credentials&client_id=//CLIENT ID//&client_secret=//CLIENT SECRET//=&scope=http://api.microsofttranslator.com

Obviously I replace //CLIENT ID// and //CLIENT SECRET// with my applications information.

I tried encoding the tokens with HtmlEncode in my application but got a 400 error. So I tried the request in my browser and this is the JSON response I got:

{ "error":"invalid_request", "error_description":"ACS90007: Request method not allowed. \r\nTrace ID: 2144c829-f3fa-4ed8-80e6-40841e6a3f69\r\nTimestamp: 2012-06-27 01:11:27Z" }

I don't know what I'm doing wrong, any help?

Upvotes: 0

Views: 2701

Answers (3)

Nitesh
Nitesh

Reputation: 1389

Making my own client secret helped my cause

Upvotes: 0

Ming Xu - MSFT
Ming Xu - MSFT

Reputation: 2116

It would be better if you can provide the code for AdmAuthentication. For now, please make sure you have correctly translated the code on http://msdn.microsoft.com/en-us/library/hh454950 to VB. Please also try to use Fiddler to monitor the request to ensure it is sending a POST request.

Best Regards,

Ming Xu.

Upvotes: 0

AvkashChauhan
AvkashChauhan

Reputation: 20576

I believe when you are making the WebRequest call your parameter is set to use GET and this will cause error ACS90007. When making the WebRequest call please use POST along with application/x-www-form-urlencoded set Content-Type.

If you still have problem post your WebRquest code snippet and i will take a look.

Upvotes: 2

Related Questions