Skip to content

Instantly share code, notes, and snippets.

Last active Aug 11, 2016
What would you like to do?
Basic Auth Test
fetch('/secrets', {credentials: 'same-origin'}).then((response) => alert('Worked!'));
import json
from flask import Flask
from flask_basicauth import BasicAuth
app = Flask(__name__)
app.config['BASIC_AUTH_USERNAME'] = 'john'
app.config['BASIC_AUTH_PASSWORD'] = 'matrix'
basic_auth = BasicAuth(app)
def index():
return open('index.html').read()
def secrets():
return json.dumps({
'token': 'abc'
if __name__ == '__main__':
Copy link

scribu commented Aug 11, 2016

This is a quick check to see if it's possible to load JSON from a file that's secured using basic auth.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment