File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed
Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change 1212from fastapi .responses import JSONResponse
1313
1414
15+ class ConfigurationError (Auth0Error ):
16+ """
17+ Error raised when an invalid configuration is used.
18+ """
19+ code = "configuration_error"
20+
21+ def __init__ (self , message = None ):
22+ super ().__init__ (message or "An invalid configuration was provided." )
23+ self .name = "ConfigurationError"
24+
1525def auth0_exception_handler (request : Request , exc : Auth0Error ):
1626 """
1727 Exception handler for Auth0 SDK errors.
Original file line number Diff line number Diff line change 66from ..auth .auth_client import AuthClient
77from ..config import Auth0Config
88from ..util import create_route_url , to_safe_redirect
9+ from ..errors import ConfigurationError
910
1011router = APIRouter ()
1112
@@ -26,6 +27,13 @@ def register_auth_routes(router: APIRouter, config: Auth0Config):
2627 """
2728 Conditionally register auth routes based on config.mount_routes and config.mount_connect_routes.
2829 """
30+ if config .mount_connect_routes and config .mount_connected_account_routes :
31+ # Connect routes uses the legacy account linking flow for token vault
32+ # Connects Accounts is the preferred mechanism
33+ # Both mount the `/auth/connect` route to initiate the flow
34+ raise ConfigurationError (
35+ "'mount_connect_routes' and 'mount_connected_account_routes' cannot be used together." )
36+
2937 if config .mount_routes :
3038 @router .get ("/auth/login" )
3139 async def login (
@@ -134,7 +142,7 @@ async def backchannel_logout(
134142 return Response (status_code = 204 )
135143
136144 if config .mount_connected_account_routes :
137- @router .get ("/auth/connect-account " )
145+ @router .get ("/auth/connect" )
138146 async def connect_account (
139147 request : Request ,
140148 response : Response ,
You can’t perform that action at this time.
0 commit comments