pallets-eco / flask-jwt

JWT (JSON Web Tokens) for Flask applications
MIT License
564 stars 178 forks source link

Raise exception when SECRET_KEY is not set in application configuration #105

Closed dusktreader closed 1 year ago

dusktreader commented 7 years ago

If the SECRET_KEY field is not specified, you get a really cryptic exception from pyjwt as follows:

    def prepare_key(self, key):
        if not is_string_type(key):
>           raise TypeError('Expecting a string- or bytes-formatted key.')
E           TypeError: Expecting a string- or bytes-formatted key.

../../.virtualenvs/flask-praetorian/lib/python3.5/site-packages/jwt/algorithms.py:116: TypeError

An exception should be raised in init_app if that configuration is not set