coolair
V2EX  ›  问与答

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

  •  
  •   coolair · Oct 19, 2023 · 831 views
    This topic created in 936 days ago, the information mentioned may be changed or developed.

    命令如下:

    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 replies    2023-10-19 14:42:49 +08:00
    jsboy
        1
    jsboy  
       Oct 19, 2023
    我觉得你需要 debug 下服务端。看看日志有啥输出,这个错误有很多可能,也可能和配置有关。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5842 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 47ms · UTC 03:20 · PVG 11:20 · LAX 20:20 · JFK 23:20
    ♥ Do have faith in what you're doing.