简体   繁体   English

Visual Studio Team Services Rest API未经授权的客户端错误

[英]Visual Studio Team Services Rest API unauthorized_client error

I am developing an JavaScript app to create work items in Visual Studio Team Services (was Visual Studio Online). 我正在开发一个JavaScript应用程序,以便在Visual Studio Team Services(以前是Visual Studio Online)中创建工作项。 But While authenticating I am getting the below error. 但是在进行身份验证时,出现以下错误。

{"Error":"unauthorized_client","ErrorDescription":null} {“错误”:“ unauthorized_client”,“错误描述”:空}

I don't want to write any C# code so I am doing it all on html/javascript way. 我不想编写任何C#代码,所以我全部以html / javascript的方式进行。 I am getting the Auth_Code but access_token. 我正在获取Auth_Code,但获得access_token。

<form method="post" action="https://app.vssps.visualstudio.com/oauth2/token?   redirect_uri=http://mycallbackurl" id="accesstoken" enctype="application/x-www-form-urlencoded">
<input type="hidden" name="client_assertion_type" value="urn:ietf:params:oauth:client-assertion-type:jwt-bearer" />
<input type="hidden" id="client_assertion" name="client_assertion" value="appSecret" />
<input type="hidden" name="grant_type" value="urn:ietf:params:oauth:grant-type:jwt-bearer" />
<input type="hidden" id="assertion" name="assertion" value="auth_code" />

I am submitting the above form and In that I am getting this error. 我正在提交上面的表格,并且由于这个错误。 I have even tried to do the same using $.ajax but the same result. 我什至尝试使用$ .ajax进行相同操作,但结果相同。

Please help me in this. 请帮助我。

You cannot send a authorize users via client side code as per the FAQ on the Auth page of the API documention. 您无法按照API文档的Auth页面上的FAQ通过客户端代码发送授权用户。

Q: Can I use OAuth with my phone app? 问:我可以在手机应用程序中使用OAuth吗?

A: No. Right now, Visual Studio Team Services only support the web server flow, so there's no supported way to implement OAuth for Visual Studio Team Services from an app like a phone app, since there's no way to securely store the app secret. 答:否。目前,Visual Studio Team Services仅支持Web服务器流,因此尚无从电话应用程序之类的应用程序为Visual Studio Team Services实施OAuth的受支持方法,因为无法安全地存储应用程序密钥。

https://www.visualstudio.com/en-us/integrate/get-started/auth/oauth https://www.visualstudio.com/zh-CN/integrate/get-started/auth/oauth

You have to do the OAuth handshake via server side code. 您必须通过服务器端代码进行OAuth握手。

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

相关问题 Visual Studio Team Services REST API 与文档不匹配? - Visual Studio Team Services REST API doesn't match documentation? 节点js与gmail api,API返回错误:错误:unauthorized_client - node js with gmail api, The API returned an error: Error: unauthorized_client Google Sheets API node.js快速入门无法正常使用:API返回了错误:错误:authorized_client - Google Sheets API node.js quickstart won't work: The API returned an error: Error: unauthorized_client Visual Studio Team Services / SonarQube:将.trx / .coverage文件转换为LCOV吗? - Visual Studio Team Services / SonarQube: Converting a .trx/.coverage file to a LCOV? 在Visual Studio Team Services上构建Cordova项目时,构建失败 - Build fails when building Cordova project on Visual Studio Team Services GatsbyJS 和 Wordpress REST API 401 未授权错误 - GatsbyJS & Wordpress REST API 401 Unauthorized Error 带Postman输出的DocumentDB REST API始终为“未授权”错误 - DocumentDB REST API with Postman outputs always “Unauthorized” error Ionic 3 WP-REST API发布请求401(未经授权)错误 - Ionic 3 WP-REST API Post request 401 (unauthorized) error 是否可以运行Visual Studio Team Services Build中的端到端测试? - Can end-to-end tests in Visual Studio Team Services Build be run? 处理来自REST API的客户端错误 - handling client side error from REST API
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM