Advertisement
Guest User

Untitled

a guest
Oct 20th, 2019
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.65 KB | None | 0 0
  1. from flask import Flask
  2. from flask_jwt_extended import JWTManager, create_access_token
  3. from flask_jwt_extended import decode_token, verify_jwt_in_request_optional, get_raw_jwt
  4.  
  5. app = Flask(__name__)
  6. app.config['SECRET_KEY'] = 'asdfdfs'
  7. app.config['JWT_SECRET_KEY'] = 'asdfdfs'
  8. app.config['JWT_TOKEN_LOCATION'] = ['query_string']
  9. app.config['JWT_ACCESS_TOKEN_EXPIRES'] = False
  10. JWTManager(app)
  11.  
  12.  
  13. with app.test_request_context():
  14.     access_token = create_access_token('qria@qria.net')
  15.     print(access_token)
  16.  
  17. @app.route('/')
  18. def index():
  19.     return str(get_raw_jwt())
  20.  
  21. with app.test_client() as c:
  22.     print(c.get(f'/?jwt={access_token}').data)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement