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条)

报告相同问题?

悬赏问题

  • ¥15 多址通信方式的抗噪声性能和系统容量对比
  • ¥15 winform的chart曲线生成时有凸起
  • ¥15 msix packaging tool打包问题
  • ¥15 finalshell节点的搭建代码和那个端口代码教程
  • ¥15 用hfss做微带贴片阵列天线的时候分析设置有问题
  • ¥15 Centos / PETSc / PETGEM
  • ¥15 centos7.9 IPv6端口telnet和端口监控问题
  • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作
  • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
  • ¥20 海浪数据 南海地区海况数据,波浪数据