from flask import Flask, render_template, redirect, jsonify, request
from flask_awscognito import AWSCognitoAuthentication
application = Flask(__name__)
application.config['AWS_DEFAULT_REGION'] = 'eu-west-1'
application.config['AWS_COGNITO_DOMAIN'] = 'https://xxxxxx.auth.eu-west-1.amazoncognito.com' #seguro
application.config['AWS_COGNITO_USER_POOL_ID'] = 'xxxxxx'
application.config['AWS_COGNITO_USER_POOL_CLIENT_ID'] = 'xxxxxxx'
application.config['AWS_COGNITO_USER_POOL_CLIENT_SECRET'] = 'xxxxxxx'
application.config['AWS_COGNITO_REDIRECT_URL'] = 'http://localhost:5000/aws_cognito_redirect'
aws_auth = AWSCognitoAuthentication(application)
@application.route('/')
@aws_auth.authentication_required
def index():
claims = aws_auth.claims
return jsonify({'claims': claims})
@application.route('/aws_cognito_redirect')
def aws_cognito_redirect():
access_token = aws_auth.get_access_token(request.args)
return jsonify({'access_token': access_token})
@application.route('/sign_in')
def sign_in():
return redirect(aws_auth.get_sign_in_url())
after sign in it shows the token properly:
But now if I type http://localhost:5000/ on the browser it says there is no Token and I have no access to the claims:
Am I missing something? thanks

