我尝试使用auth0邮递员模板通过用户名和密码发出身份验证请求,但得到了一个unsupported grant type: password error
。我做错了什么?
var client = new RestClient("https://test.auth0.com/oauth/token");
var request = new RestRequest(Method.POST);
request.AddHeader("postman-token", "abc");
request.AddHeader("cache-control", "no-cache");
request.AddHeader("content-type", "application/x-www-form-urlencoded");
request.AddParameter("application/x-www-form-urlencoded", "grant_type=password&client_id=foo&audience=&username=test&password=test&scope=openid%20email%20picture%20nickname", ParameterType.RequestBody);
发布于 2018-02-22 21:55:40
转到默认应用>设置>
在设置的底部,单击{显示高级设置}
选择授权类型选项卡
检查默认情况下未选中的密码
Post请求到*//oauth/token,它可以工作
发布于 2018-09-04 07:27:15
这些正是我为了解决这个问题而采取的步骤
使用桌面上的浏览器登录界面右上角,单击用户名、设置
向下滚动到API授权设置
在默认受众和默认目录中输入有效值。
例如,对于我来说,我已经使用了Lock screen,并且已经在我的客户端应用程序中设置了一个默认的受众,一切都正常。
我还设置了一个名为Username-Password-Authentication的Connections > Database。
以下是完成上述操作后,使用postman集合的工作情况的屏幕截图,在撰写本文时,该集合包含在此处
https://app.getpostman.com/run-collection/2a9bc47495ab00cda178
在这里引用的
https://auth0.com/docs/api/authentication#code-samples
https://stackoverflow.com/questions/41626602
复制相似问题