简体   繁体   English

请求令牌时出现400(错误请求)

[英]400 (Bad Request) when I request a token

I have written the following code to connect and retrieve a token from the Autodesk . 我编写了以下代码,以从Autodesk连接和检索令牌。 but this does not work properly: 但这不能正常工作:

var client = new RestClient("https://accounts.autodesk.com");
client.Authenticator = OAuth1Authenticator.ForRequestToken(consumerKey, consumerSecret);
var request = new RestRequest("OAuth/RequestToken", Method.POST);
var response = await _client.Execute(request);

Executing the request it throws a bad request exception. 执行请求会引发错误的请求异常。

Response status code does not indicate success: 400 (Bad Request).

For consumerKey and consumerSecret I respectively used my email and the associated password that I've already registered in accounts.autodesk.com 对于consumerKeyconsumerSecret我分别使用了我已经在accounts.autodesk.com中注册的电子邮件和相关密码。

How can I understand if I'm sending the request in a wrong format or I just send a wrong consumerKey and consumerSecret . 如果我以错误的格式发送请求,或者只是发送了错误的consumerKeyconsumerSecret我该如何理解。 And If they are wrong could you please guide me where I can obtain these parameters from Autodesk? 如果它们是错误的,请您指导我在哪里可以从Autodesk获得这些参数?

It's not at all your email and password that you need to use but API keys that are generated from your account on our developer portal. 完全不需要使用您的电子邮件和密码,而是从您在我们的开发人员门户上的帐户生成的API密钥。

Please sign up or login to the portal: https://developer.autodesk.com/ And follow the step by step tutorial in order to request a token, there are detailed explanations of the workflow there, it can't be easier than that: https://developer.autodesk.com/en/docs/oauth/v2/tutorials . 请注册或登录门户网站: https : //developer.autodesk.com/并按照分步教程进行操作以请求令牌,那里有工作流的详细说明,这比这容易得多: https : //developer.autodesk.com/en/docs/oauth/v2/tutorials

I have created a C# sample and a lib but it hasn't been updated yet to use scopes, you can take a look at the discussion in the issues: https://github.com/Developer-Autodesk/view.and.data-dotnet-wpf.tutorial 我已经创建了一个C#示例和一个lib,但是尚未对其进行更新以使用范围,您可以查看问题中的讨论: https : //github.com/Developer-Autodesk/view.and.data -dotnet-wpf.tutorial

Finally we are working on generated wrappers for our REST API's so we will be able to produce more stable samples pretty soon. 最终,我们正在为REST API生成生成的包装,因此我们很快就能生成更稳定的样本。 Check out our blog for upcoming news about that: http://adndevblog.typepad.com/cloud_and_mobile 请查看我们的博客以获取有关该消息的近期新闻: http : //adndevblog.typepad.com/cloud_and_mobile

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM