flask
PyJWT
flask-cors
Add the following lines to your base code
# Controllers API
# This doesn't need authentication
@APP.route("/api/public")
@cross_origin(headers=["Content-Type", "Authorization"])
def public():
response = "Hello from a public endpoint! You don't need to be authenticated to see this."
return jsonify(message=response)
# This needs authentication
@APP.route("/api/private")
@cross_origin(headers=["Content-Type", "Authorization"])
@requires_auth
def private():
response = "Hello from a private endpoint! You need to be authenticated to see this."
return jsonify(message=response)
# This needs authorization
@APP.route("/api/private-scoped")
@cross_origin(headers=["Content-Type", "Authorization"])
@requires_auth
def private_scoped():
if requires_scope("read:messages"):
response = "Hello from a private endpoint! You need to be authenticated and have a scope of read:messages to see this."
return jsonify(message=response)
raise AuthError({
"code": "Unauthorized",
"description": "You don't have access to this resource"
}, 403)
Auth0 is the easiest way for developers to integrate enterprise-grade authentication and identity management to any app.
SOC 2, HIPAA/BAA, EU/US Privacy Shield Framework, Open ID Certified.
Learn MoreContinuously reviewed and tested by external security experts. Strong password encryption and hashing algorithms, at rest and in transit.
Learn MoreContinuously reviewed and tested by external security experts. Strong password encryption and hashing algorithms, at rest and in transit.
Learn MoreUptime time in 3 different regions.
Learn MoreDeploy On-Premises or on Cloud on your data center or Auth0’s one.
Learn MoreAuthenticate iOS Swift - Facebook Login with Azure Active Directory Native
Authenticate iOS Swift with Azure Active Directory Native
Authenticate PHP API with Azure Active Directory Native
Authenticate iOS Swift - Sign In With Apple with Azure Active Directory Native
Authenticate ASP.NET Core Web API v2.1 with Azure Active Directory Native