In using FLASK CSRF cookies how can I validate the actual CSRF

17 Views Asked by At

In using with CSRF in Flask the checkauth route is saying "fine" and allowing this to go through....is the CSRF getting checked automatically or do I need to do something specific?

In addition how would I check the CSRF...seems like a lot of FLASK documentation says hey use this double check but then fails to show how to check it.

@login_blu.route('/login',methods=['GET'])
def login():
    username = 'milei'
    access_token = create_access_token(identity=username)
    refresh_token = create_refresh_token(identity=username)

    # Set the JWT cookies in the response
    resp = jsonify({'login': True})
    set_access_cookies(resp, access_token)
    set_refresh_cookies(resp, refresh_token)
    return resp, 200
    return jsonify({'login':'values'})

    @login_blu.route('/checkauth',methods=['GET'])
    @jwt_required()
    def checkauth():
    # Set the JWT cookies in the response
    
        return jsonify({'test':'test'})
0

There are 0 best solutions below