debug auth
This commit is contained in:
parent
8cd0856728
commit
9380f0485c
4 changed files with 5 additions and 2 deletions
|
@ -2,12 +2,15 @@ from flask import Blueprint, request, jsonify, session
|
||||||
from .users.api_users import api_users
|
from .users.api_users import api_users
|
||||||
from .rooms.api_rooms import api_rooms
|
from .rooms.api_rooms import api_rooms
|
||||||
|
|
||||||
|
from auth.auth import auth
|
||||||
|
|
||||||
api = Blueprint('api', __name__, url_prefix='/api')
|
api = Blueprint('api', __name__, url_prefix='/api')
|
||||||
|
|
||||||
def register_api_endpoints(app):
|
def register_api_endpoints(app):
|
||||||
app.register_blueprint(api_users)
|
app.register_blueprint(api_users)
|
||||||
app.register_blueprint(api_rooms)
|
app.register_blueprint(api_rooms)
|
||||||
app.register_blueprint(api)
|
app.register_blueprint(api)
|
||||||
|
app.register_blueprint(auth)
|
||||||
return app
|
return app
|
||||||
|
|
||||||
@api.route('/home', methods=['GET'])
|
@api.route('/home', methods=['GET'])
|
||||||
|
|
|
@ -6,7 +6,6 @@ def jwt_required():
|
||||||
def decorator(func):
|
def decorator(func):
|
||||||
def authorized(*args, **kwargs):
|
def authorized(*args, **kwargs):
|
||||||
auth_header = request.headers.get('Authorization') or None
|
auth_header = request.headers.get('Authorization') or None
|
||||||
print(User.decode_auth_token(auth_header.split(" ")[1]))
|
|
||||||
if auth_header:
|
if auth_header:
|
||||||
auth_token = auth_header.split(" ")[1]
|
auth_token = auth_header.split(" ")[1]
|
||||||
if jwt.decode(auth_token, os.environ.get('SECRET_KEY')):
|
if jwt.decode(auth_token, os.environ.get('SECRET_KEY')):
|
||||||
|
|
|
@ -5,7 +5,7 @@ from ..decorators import jwt_required
|
||||||
|
|
||||||
api_rooms = Blueprint('api_rooms', __name__, url_prefix='/api/rooms')
|
api_rooms = Blueprint('api_rooms', __name__, url_prefix='/api/rooms')
|
||||||
|
|
||||||
@api_rooms.route('/<id>', methods=['GET'])
|
@api_rooms.route('/<room_id>', methods=['GET'])
|
||||||
def get_room():
|
def get_room():
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
|
@ -52,6 +52,7 @@ def auth_login():
|
||||||
try:
|
try:
|
||||||
# fetch the user data
|
# fetch the user data
|
||||||
print('getting here')
|
print('getting here')
|
||||||
|
print(data)
|
||||||
user = User.query.filter_by(email=data['email']).first()
|
user = User.query.filter_by(email=data['email']).first()
|
||||||
print(user.username)
|
print(user.username)
|
||||||
auth_token = user.encode_auth_token(user.id)
|
auth_token = user.encode_auth_token(user.id)
|
||||||
|
|
Loading…
Reference in a new issue