We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b670790 commit 433e8e5Copy full SHA for 433e8e5
facade-poc/server.py
@@ -6,7 +6,8 @@
6
# Hardcoded API key
7
API_KEY = "TEST-API-KEY"
8
HEADER_NAME = "X-API-Key"
9
-# First endpoint
+
10
+# Unsecured endpoint
11
@app.route('/unsecured', methods=['GET'])
12
def unsecured():
13
data = {'message': 'This is an unsecured endpoint.'}
@@ -18,10 +19,11 @@ def endpoint2():
18
19
# Check if API key is provided in the request headers
20
provided_api_key = request.headers.get(HEADER_NAME)
21
22
+ # API key is invalid, return send unauthorized
23
if provided_api_key != API_KEY:
24
return jsonify({'error': 'Unauthorized access. Invalid API key.'}), 401
25
- # API key is valid, return data
26
27
data = {'message': 'This is a secured endpoint.'}
28
return jsonify(data)
29
0 commit comments