Giter Club home page Giter Club logo

Comments (6)

miguelgrinberg avatar miguelgrinberg commented on June 1, 2024 3

Here is one possible problem. You may need to add a WSGIPassAuthorization clause to your configuration, by default Apache does not let the Authorization header pass thru to your app.

from flask-httpauth.

miguelgrinberg avatar miguelgrinberg commented on June 1, 2024

Can I see your code and your apache configuration?

from flask-httpauth.

LLCampos avatar LLCampos commented on June 1, 2024

Sure.

My _ init _.py

from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_httpauth import HTTPBasicAuth
from tasks import make_celery


app = Flask(__name__)
app.config.from_pyfile('../config.cfg')


celery = make_celery(app)
db = SQLAlchemy(app)

auth = HTTPBasicAuth()


@auth.get_password
def get_pw(username):
    if username == app.config['BASIC_AUTH_USERNAME']:
        return app.config['BASIC_AUTH_PASSWORD']


import tpp.views

My views.py

from flask import request, render_template, jsonify

from util import split_span
from tpp import app, auth
from models import *

import ast


@app.route('/', methods=['GET'])
@auth.login_required
def index_page():
    reports = Report.get_last_n_reports(10)
    return render_template('index.html', reports=reports)


@app.route('/report/<int:report_id>', methods=['GET'])
@auth.login_required
def report_page(report_id):
    (...)

The app is being deployed on a server with a lot of apps, which can be accessed by going to the url

http://www.lasige.di.fc.ul.pt/webtools/{name_of_app}

The only configuration that I've wrote regarding my app was this line:

WSGIScriptAlias /webtools/tpp {path to tpp.wsgi}

Until now everything worked like in my machine.

from flask-httpauth.

normanpilusa avatar normanpilusa commented on June 1, 2024

Hi Miguel
I have a similar problem as above. I tried your suggestion but the problem has not been solved after restarting apache2

from flask-httpauth.

miguelgrinberg avatar miguelgrinberg commented on June 1, 2024

@normanpilusa I suggest you ask in Stack Overflow. I do not use Apache, so I can't really help you.

from flask-httpauth.

miguelgrinberg avatar miguelgrinberg commented on June 1, 2024

This issue will be automatically closed due to being inactive for more than six months. Please reopen if you need more assistance.

from flask-httpauth.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.