-
-
Notifications
You must be signed in to change notification settings - Fork 140
Closed
Description
Example usage from a user:
from apiflask import APIFlask, HTTPTokenAuth
# API Key
apikey = HTTPTokenAuth(scheme='ApiKey', header='X-API-Key')
apikeys = {"123": "123",
"456":"456"}
@apikey.verify_token
def verify_apikey(apikey):
if apikey in apikeys:
return apikeys[apikey]
app = APIFlask(__name__)
# Outh2
app.security_schemes = {
'OpenID': {
'type': 'openIdConnect',
'openIdConnectUrl': 'https://login.microsoftonline.com/68ff8/v2.0/.well-known/openid-configuration'
}
}
@app.get('/outh2test')
@app.doc(security='OAuth2')
def ouath2test():
print ("hello")
@app.get('/apikeytest')
@app.auth_required(apikey)
def apikeytest():
print ("hello")Reactions are currently unavailable