New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate client_model #27

Closed
lepture opened this Issue Feb 11, 2018 · 0 comments

Comments

Projects
None yet
1 participant
@lepture
Owner

lepture commented Feb 11, 2018

There is no need to pass the Client model class into servers. Here is the upgrade guide.

Flask OAuth 1 Server

Flask OAuth 1 server has been redesigned a lot. It's better to read the documentation again.

Flask OAuth 2 Server

Pass a query_client function to AuthorizationServer instead of client_model:

from authlib.flask.oauth2 import AuthorizationServer
from your_project.models import Client

def query_client(client_id):
    return Client.query.filter_by(client_id=client_id).first()

server = AuthorizationServer(app, query_client)
# or lazily
server = AuthorizationServer()
server.init_app(app, query_client)

There is a helper function to create query_client:

from authlib.flask.oauth2.sqla import create_query_client_func

query_client = create_query_client_func(db.session, Client)

@lepture lepture added this to the Version 0.5 milestone Feb 11, 2018

@lepture lepture closed this Feb 11, 2018

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