代码之家  ›  专栏  ›  技术社区  ›  Denis Steinman

应用程序在请求访问令牌时崩溃

  •  0
  • Denis Steinman  · 技术社区  · 8 年前

    我正在尝试使用授权码获取访问令牌:

    curl --basic --user "{client_id}:{client_secret}" -X POST -d "grant_type=authorization_code&code={code}&state={state}" http://127.0.0.1:5000/oauth/token
    

    我通过了 状态 我请求授权码时的参数:

    http://127.0.0.1:5000/oauth/authorize?response_type=code&client_id={client_id}&state={state}
    

    但我的身份验证服务回应:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
    <title>500 Internal Server Error</title>
    <h1>Internal Server Error</h1>
    <p>The server encountered an internal error and was unable to complete your request.  Either the server is overloaded or there is an error in the application.</p>
    

    我在调试模式下检查了执行,Authlib正在尝试获取 状态 输入 OAuthRequest 但是找不到。
    我搞不懂我做错了什么?

    路线:

    @bp.route("/oauth/authorize", methods=['GET'])
    @login_required
    def authorize():
        user = current_user()
        return server.create_authorization_response(grant_user=user)
    
    
    @bp.route('/oauth/token', methods=['POST'])
    def issue_token():
        return server.create_token_response()
    
    0 回复  |  直到 8 年前
    推荐文章