Commit 75fd2391 authored by Guillermo Sanz López's avatar Guillermo Sanz López
Browse files

add enable cross origin

parent f6cea190
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
#!/usr/bin/env python3
from flask import Blueprint, jsonify, request
from flask_jwt_extended import JWTManager, create_access_token, create_refresh_token, get_jwt_identity, jwt_required
from flask_cors import cross_origin

# create blueprint backoffice_routes
access_routes = Blueprint("acces_routes", __name__)

@access_routes.route("/login", methods=["POST"])
@cross_origin()
def login():
    username = request.form.get("username", None)
    password = request.form.get("password", None)
@@ -24,6 +26,7 @@ def login():
    return jsonify(access_token=access_token, refresh_token=refresh_token)

@access_routes.route('/refresh', methods=["POST"])
@cross_origin()
@jwt_required
def refresh():
    current_user = get_jwt_identity()