Coder Social home page Coder Social logo

singingwolfboy / flask-dance-google-sqla Goto Github PK

View Code? Open in Web Editor NEW
18.0 18.0 11.0 18 KB

Example app that logs in with Google using Flask-Dance

Home Page: https://flask-dance-google-sqla.herokuapp.com/

License: MIT License

Python 91.63% HTML 6.59% Shell 1.77%

flask-dance-google-sqla's People

Contributors

singingwolfboy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

flask-dance-google-sqla's Issues

Deploy to Heroku button fails

Hi,

thanks for flask-dance! It's fantastic!

I'm trying out the Deploy to Heroku button, and I get error on deployment

Run scripts & scale dynos
Postdeploy exit code was not 0

Am I missing some step before attempting depolyment with the button?

Thanks!

Traceback (most recent call last):
  File "/app/.heroku/python/bin/flask", line 8, in <module>
    sys.exit(main())
  File "/app/.heroku/python/lib/python3.9/site-packages/flask/cli.py", line 990, in main
    cli.main(args=sys.argv[1:])
  File "/app/.heroku/python/lib/python3.9/site-packages/flask/cli.py", line 596, in main
    return super().main(*args, **kwargs)
  File "/app/.heroku/python/lib/python3.9/site-packages/click/core.py", line 1062, in main
    rv = self.invoke(ctx)
  File "/app/.heroku/python/lib/python3.9/site-packages/click/core.py", line 1668, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/app/.heroku/python/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/app/.heroku/python/lib/python3.9/site-packages/click/core.py", line 763, in invoke
    return __callback(*args, **kwargs)
  File "/app/.heroku/python/lib/python3.9/site-packages/click/decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/app/.heroku/python/lib/python3.9/site-packages/flask/cli.py", line 440, in decorator
    return __ctx.invoke(f, *args, **kwargs)
  File "/app/.heroku/python/lib/python3.9/site-packages/click/core.py", line 763, in invoke
    return __callback(*args, **kwargs)
  File "/app/app/cli.py", line 9, in create_db
    db.create_all()
  File "/app/.heroku/python/lib/python3.9/site-packages/flask_sqlalchemy/__init__.py", line 1094, in create_all
    self._execute_for_all_tables(app, bind, 'create_all')
  File "/app/.heroku/python/lib/python3.9/site-packages/flask_sqlalchemy/__init__.py", line 1086, in _execute_for_all_tables
    op(bind=self.get_engine(app, bind), **extra)
  File "/app/.heroku/python/lib/python3.9/site-packages/flask_sqlalchemy/__init__.py", line 1017, in get_engine
    return connector.get_engine()
  File "/app/.heroku/python/lib/python3.9/site-packages/flask_sqlalchemy/__init__.py", line 594, in get_engine
    self._engine = rv = self._sa.create_engine(sa_url, options)
  File "/app/.heroku/python/lib/python3.9/site-packages/flask_sqlalchemy/__init__.py", line 1027, in create_engine
    return sqlalchemy.create_engine(sa_url, **engine_opts)
  File "<string>", line 2, in create_engine
  File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/util/deprecations.py", line 298, in warned
    return fn(*args, **kwargs)
  File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/engine/create.py", line 522, in create_engine
    entrypoint = u._get_entrypoint()
  File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/engine/url.py", line 636, in _get_entrypoint
    cls = registry.load(name)
  File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/util/langhelpers.py", line 343, in load
    raise exc.NoSuchModuleError(
sqlalchemy.exc.NoSuchModuleError: Can't load plugin: sqlalchemy.dialects:postgres

Warning: Scope has changed from "profile email" to "https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email openid".

Hello, I'm having quite some trouble implementing this template on localhost as a flask/code newbie. The newest issue is a scope issue:

Warning: Scope has changed from "profile email" to "https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email openid".

Switching to the adress given is not working.

My guess is it's related to this:
blueprint = make_google_blueprint( scope=["profile", "email"], storage=SQLAlchemyStorage(OAuth, db.session, user=current_user), )

What excatly should be changed to keep this code running? If the warning isn´t an issue can it be silenced?

Other errors I had:

  • sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) no such table: flask_dance_oauth
  • oauthlib.oauth2.rfc6749.errors.InsecureTransportError: (insecure_transport) OAuth 2 MUST utilize https.

image

image

Tests failing with recent sqlalchemy/flask-sqlachemy

Checking out the repository and running the tests shows 3 out of 4 tests failing with a problem in flask-sqlalchemy:

ERROR tests/test_index.py::test_index_authorized - AttributeError: create_scoped_session
ERROR tests/test_oauth.py::test_oauth_create_user - AttributeError: create_scoped_session
ERROR tests/test_oauth.py::test_oauth_login_user - AttributeError: create_scoped_session

Pinning flask_sqlalchemy to the previous major version leads to an import error, seemingly due to a mismatch with sqlalchemy not captured correctly in dependencies:

ImportError while loading conftest '/Users/chrisroat/flask-dance-google-sqla/tests/conftest.py'.
tests/conftest.py:15: in <module>
    from app import app as flask_app
app/__init__.py:4: in <module>
    from .models import db, login_manager
app/models.py:6: in <module>
    db = SQLAlchemy()
venv/lib/python3.11/site-packages/flask_sqlalchemy/__init__.py:758: in __init__
    _include_sqlalchemy(self, query_class)
venv/lib/python3.11/site-packages/flask_sqlalchemy/__init__.py:112: in _include_sqlalchemy
    for key in module.__all__:
E   AttributeError: module 'sqlalchemy' has no attribute '__all__'

Pinning sqlalchemy back to a previous major version resolves this.

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.