flask-oauthlib server doesn't play well with requests-oauthlib client flask-oauthlib server doesn't play well with requests-oauthlib client flask flask

flask-oauthlib server doesn't play well with requests-oauthlib client


The logger is very clear.

Requesting url http://127.0.0.1:5000/oauth/token using method POST.Request to fetch token completed with status 405.<title>405 Method Not Allowed</title><h1>Method Not Allowed</h1><p>The method is not allowed for the requested URL.</p>

That means you can't POST to http://127.0.0.1:5000/oauth/token. If you have ever checked the example at https://github.com/lepture/example-oauth2-server/blob/master/app.py#L223 you will find that it doesn't accept a POST request.

You can either change the example:

@app.route('/oauth/token', methods=['POST'])@oauth.token_handlerdef access_token():    return None

Or you can request with a GET method for access token, which I believe can be set in requests-oauthlib.