Skip to content

jwt_refresh_token_required on OPTION request #116

@wogscpar

Description

@wogscpar

Hello,

I'm not sure if this is an issue or if this is a expected behavior. Anyway, I'm developing an API which uses JWT tokens for authentication. I'm getting unauthorized when I'm trying to refresh the access token using the example:

@app.route('/refresh', methods=['POST'])
@jwt_refresh_token_required
def refresh():
    current_user = get_jwt_identity()
    new_token = create_access_token(identity=current_user, fresh=False)
    ret = {'access_token': new_token}
    return jsonify(ret), 200

If the client is located on a different origin than the server, then this function will return unauthorized because of the empty OPTION request before the real POST request is sent.

Shouldn't @jwt_refresh_token_required check if the request is a OPTION request and then ignore the absence of the token but act on all other requests?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions