Necessary Changes for Creating the Authentication API

Learn what changes to make when creating the authentication API.

The authentication API is where the various pieces come together. First, we’ll use password hashing to create authentication records and verify credentials. Second, we’ll provide the means by which a user can authenticate and receive their access token. Third, we’ll show an example of how to modify a route to make it require a valid access token.

Imports

The imports are mostly familiar. The new ones are auth_orm, which we just created in the previous lesson, and flask_jwt_extended, which makes it easy to work with JWT access tokens. To install it, we use pipenv. We’ll notice, however, that it’s installed using hyphens between the words but imported using underscores.

$ pipenv install flask-jwt-extended

To create the API, we’ll need the usual imports, and also our new ORM class.

Get hands-on with 1200+ tech skills courses.