2022-05-27 13:28:26 +02:00
|
|
|
from authlib.oauth2.rfc7636 import CodeChallenge
|
|
|
|
from flask import Flask
|
|
|
|
|
2022-05-27 14:18:50 +02:00
|
|
|
from .grants import AuthorizationCodeGrant, RefreshTokenGrant
|
2022-05-27 13:28:26 +02:00
|
|
|
from .server import authorization_server
|
|
|
|
|
|
|
|
|
|
|
|
def config_oauth(app: Flask) -> None:
|
|
|
|
authorization_server.init_app(app)
|
|
|
|
|
|
|
|
# supported grants
|
|
|
|
authorization_server.register_grant(
|
|
|
|
AuthorizationCodeGrant, [CodeChallenge(required=True)]
|
|
|
|
)
|
2022-05-27 14:18:50 +02:00
|
|
|
authorization_server.register_grant(RefreshTokenGrant)
|