Authentication Flask API using Json Web Tokens
Simple flask app with authentication using JWT — Python

In this story we are going to look how authentication and authorisation using flask login in flask python. Authentication means you validate someone’s credentials and authorisation is determining they can access the part of the site.
Let’s get our hands on and understand what it is.
First let us go through the libraries which we are going to use in this tutorial.
- Libraries Used
Flask: Flask is a popular Python web framework, meaning it is a third-party Python library used for developing web applications.
uuid: UUID, Universal Unique Identifier, is a python library which helps in generating random objects of 128 bits as ids.
werkzeug: Werkzeug is python library which contains lot of development and debugging tools for implementation of web application gateway interface(WSGI) applications. In this tutorial we use it to generate and check password hash.
PyJWT: PyJWT is a Python library which allows you to encode and decode JSON Web Tokens (JWT).
functools: functools is a standard Python module for higher-order functions (functions that act on or return other functions). wraps() is a decorator that is applied to the wrapper function of a decorator. It updates the wrapper function to look like wrapped function by coping attributes such as __name__, __doc__ (the docstring), etc.
pymongo: The PyMongo distribution contains tools for interacting with MongoDB database from Python.
Now let’s create a simple flask application with two routes. Since this a tutorial one of route can be accessed without authentication but the other require authentication.












