[英]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.