@app.route('/login', methods=['POST'])
def login():
    error = None
if request.method == 'POST':
    data = b64decode(request.data)
if not data:
    data = b64decode(list(request.form.keys())[0])
special_mimetype = request.mimetype
return special_mimetype + '\n' + data
Force Content-Type or expose request.data in Flask for known content-type