dongliang9576 2015-08-17 23:09
浏览 86
已采纳

当我在apiagility中使用Postman和oauth2进行登录访问时,为什么会出现错误?

I am new to Zend Framework 2. I am trying to get the login access scenario working with Postman (chrome extension). I have gone through the forum but I'm not sure if I'm missing something or not. So here are the steps that I have taken so far: In MYSQL I have set up the tables accordingly and there is a user with the following fields in the oauth_clients table:

  • client_id : testclient
  • client_secret : testpass
  • redirect_uri : /oauth/receivecode (I'm not sure about the value of this one could someone please shed some light on this?)
  • grant_type : password ( I want to use the service for authentication and authorization to access a website or login access scenario)

The rest of the fields are NULL. No other entries in other tables. I set the parameters in Postman like this:

  • Authorization : Oauth2

Headers:

  • Accept : application/json
  • Content-Type : application/json

The raw body is like:

{
    "client_id":"testclient",
    "client_secret":"testpass",
    "grant_type":"password"
}

I post the request to: www.dummy.dev/oauth/authorize

When I post the request this is what I get:

{
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html",
  "title": "invalid_request",
  "status": 302,
  "detail": "Invalid or missing response type"
}

Why do I get this error message?

  • 写回答

2条回答 默认 最新

  • donglulong0877 2015-08-18 16:14
    关注

    redirect uri is not necessary and could be left null in the database as well. The correct uri to POST is www.dummy.dev/oauth and the raw parameters in Postman are:

    {
        "client_id":"dev.dummy",
        "username":"testclient",
        "password":"testpass",
        "grant_type":"password"
    }
    

    The value of password is stored and encoded (with bcrypt) in the database. client_id and client_secret are not important in this scenario as my own website is the client of my API.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!