Skip to content

abhiinavv-31/exp9

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Experiment 9 – Token Based Authentication using Flask

Objective

Implement token based authentication using Flask and test APIs using Postman.

Technologies Used

  • Python
  • Flask
  • JWT (PyJWT)
  • Postman

APIs Implemented

1. Authorization Header

Endpoint: /auth-header
Method: GET

Authentication using Basic Authorization Header.


2. Custom Header

Endpoint: /custom-header
Method: GET

Authentication using custom headers.

Headers used: X-Username
X-Password


3. JWT Authentication

Generate Token

Endpoint: /login
Method: POST

Body: { "username":"admin", "password":"1234" }


Access Protected Route

Endpoint: /jwt-protected
Method: GET

Header: Authorization : Bearer TOKEN


Steps to Run

  1. Install dependencies

pip install flask pyjwt

  1. Run server

python app.py

Server runs at:

http://127.0.0.1:5000

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages