singingwolfboy / flask-dance

Doing the OAuth dance with style using Flask, requests, and oauthlib.
https://pypi.python.org/pypi/Flask-Dance/
MIT License
997 stars 156 forks source link

Oauth using github gives page not found #399

Open blpraveen opened 1 year ago

blpraveen commented 1 year ago

Redirects 404 page.

@app.route('/github')
def github_login():
    if not github.authorized:
        return redirect(url_for('github.login'))

    account_info = github.get('/user')

    if account_info.ok:
        account_info_json = account_info.json()

        return '<h1>Your Github name is {}'.format(account_info_json['login'])

    return '<h1>Request failed!</h1>'
singingwolfboy commented 1 year ago

https://github.com/singingwolfboy/flask-dance-github seems to be working: it's deployed at https://flask-dance-github.herokuapp.com. Could you be more specific about what your problem is, and how to reproduce it?

TomGoBravo commented 1 year ago

I ran into this issue when I migrated my code to running in a docker container. I didn't intend to change anything but the browser ended up getting a 404. Checking the URL of that 404 I saw https://github.com/login/oauth/authorize?response_type=code&client_id=None&redirect_uri=https.... (note the client_id=None). When I changed my production setup to run in a docker container I forgot to migrate the flask secrets.cfg. There doesn't seem to be any warning that client_id is unset and you get a 404 error.