V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
coolair
V2EX  ›  问与答

彦祖们,帮忙看看我这命令行测试 Spring OAuth2 哪里有问题?

  •  
  •   coolair · 202 天前 · 394 次点击
    这是一个创建于 202 天前的主题,其中的信息可能已经有所发展或是发生改变。

    命令如下:

    curl -X POST login-client:openid-connect@localhost:9000/oauth2/token -d "grant_type=authorization_code" -d "scope=profile" -d "code=W37wCNX8w5qbOS8l7jirU78ldtpReMZ6LldW2TxN1uCdNJk_q7KC-5yzJENVqwB0wnw_HGkFoZaFr_eeQ9fWP1YmR8SdUuohEyPnImBbkSjB9W4LDU-nZOxjNc8o7Lxk" -d "state=2YF7hbOWMOqSa4ALEP-NuPcl2mAUey9GmNWiT-JpO48=" -d "redirect_uri=http://127.0.0.1:9000/authorized" -d "client_id=login-client"
    

    使用代码测试没问题,使用命令测试报错:

    {
      "error": "invalid_grant"
    }
    

    是哪里没写对吗?

    1 条回复    2023-10-19 14:42:49 +08:00
    jsboy
        1
    jsboy  
       201 天前
    我觉得你需要 debug 下服务端。看看日志有啥输出,这个错误有很多可能,也可能和配置有关。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5691 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 37ms · UTC 05:52 · PVG 13:52 · LAX 22:52 · JFK 01:52
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.