We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 385f5de commit 6247df3Copy full SHA for 6247df3
python-flask-rest-api-basic-auth/readme.rst
@@ -0,0 +1 @@
1
+You can read tutorial https://www.roytuts.com/python-flask-http-basic-authentication/
python-flask-rest-api-basic-auth/rest.py
@@ -0,0 +1,23 @@
+from flask import Flask
2
+from flask import jsonify
3
+from flask_httpauth import HTTPBasicAuth
4
+
5
+app = Flask(__name__)
6
+auth = HTTPBasicAuth()
7
8
+@app.route('/rest-auth')
9
+@auth.login_required
10
+def get_response():
11
+ return jsonify('You are an authenticate person to see this message')
12
13
+@auth.verify_password
14
+def authenticate(username, password):
15
+ if username and password:
16
+ if username == 'roy' and password == 'roy':
17
+ return True
18
+ else:
19
+ return False
20
21
22
+if __name__ == "__main__":
23
+ app.run()
0 commit comments