<reponame>laobevilaqua/flask-template<filename>auth/model.py
import os
from flask import request
import jwt


class Auth:

    @staticmethod
    def is_authenticated():
        try:
            token = request.headers.get('Authorization').replace('Bearer', '')
            
            if token is None:
                return False
            
            request.user = jwt.decode(token, os.environ.get('JWT_SECRET', 'dev'))
            return True
        except:
            return False

            

import os
from flask import request
import jwt


class Auth:

    @staticmethod
    def is_authenticated():
        try:
            token = request.headers.get('Authorization').replace('Bearer', '')
            
            if token is None:
                return False
            
            request.user = jwt.decode(token, os.environ.get('JWT_SECRET', 'dev'))
            return True
        except:
            return False