more oauth2 fixes
This commit is contained in:
parent
65ceb2abbd
commit
14d219eef7
7 changed files with 45 additions and 17 deletions
|
@ -8,8 +8,10 @@ from oauthlib.oauth2.rfc6749.errors import TokenExpiredError
|
|||
from authlib.integrations.base_client.errors import InvalidTokenError
|
||||
from ory_hydra_client.api.o_auth_2 import list_o_auth_2_clients, get_o_auth_2_client, set_o_auth_2_client, create_o_auth_2_client
|
||||
from ory_hydra_client.models import OAuth20Client, GenericError
|
||||
from typing import Optional
|
||||
from typing import Optional, List
|
||||
from collections.abc import Iterable
|
||||
from http import HTTPStatus
|
||||
import httpx
|
||||
import logging
|
||||
|
||||
from ..model import db, User
|
||||
|
@ -77,7 +79,12 @@ def registration_accept(registration_id) -> ResponseReturnValue:
|
|||
|
||||
@admin_views.route('/clients')
|
||||
async def clients() -> ResponseReturnValue:
|
||||
clients = await list_o_auth_2_clients.asyncio_detailed(_client=hydra_service.hydra_client)
|
||||
response = await list_o_auth_2_clients.asyncio_detailed(_client=hydra_service.hydra_client)
|
||||
clients = response.parsed
|
||||
if clients is None:
|
||||
logger.error(f"could not fetch client list response {response}")
|
||||
return 'internal error', 500
|
||||
logger.error(f'{clients}')
|
||||
return render_template('admin/clients.html.j2', clients=clients)
|
||||
|
||||
@admin_views.route('/client/<client_id>', methods=['GET', 'POST'])
|
||||
|
|
|
@ -92,11 +92,12 @@ def init_login_manager(app: Flask) -> None:
|
|||
name="custom",
|
||||
client_id=app.config['OAUTH_ID'],
|
||||
client_secret=app.config['OAUTH_SECRET'],
|
||||
server_metadata_url=f'{base_url}/.well-known/openid-configuration',
|
||||
access_token_url=f"{base_url}/oauth2/token",
|
||||
authorize_url=f"{base_url}/oauth2/auth",
|
||||
api_base_url=base_url,
|
||||
|
||||
client_kwargs={'scope': ' '.join(['openid', 'profile', 'manage'])}
|
||||
client_kwargs={'scope': ' '.join(['openid', 'profile', 'manage'])},
|
||||
)
|
||||
oauth2.init_app(app)
|
||||
login_manager.init_app(app)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue