@@ -107,6 +107,9 @@ class StarletteAdapter(BaseAdapter, Starlette):
107107 An optional :class:`str` passed to use as the EventSub secret. It is recommended you pass this parameter when using
108108 an adapter for EventSub, as it will reset upon restarting otherwise. You can generate token safe secrets with the
109109 :mod:`secrets` module.
110+ oauth_path: str | None
111+ An optional :class:`str` passed to use as the path for the OAuth route. Defaults to ``/oauth``.
112+ E.g. ``http://localhost:4343/oauth`` or ``https://mydomain.org/oauth``.
110113 redirect_path: str | None
111114 An optional :class:`str` passed to use as the path for the Oauth Redirect callback. Defaults to ``/oauth/callback``.
112115 E.g. ``http://localhost:4343/oauth/callback`` or ``https://mydomain.org/oauth/callback``.
@@ -160,6 +163,7 @@ def __init__(
160163 domain : str | None = None ,
161164 eventsub_path : str | None = None ,
162165 eventsub_secret : str | None = None ,
166+ oauth_path : str | None = None ,
163167 redirect_path : str | None = None ,
164168 ssl_keyfile : str | PathLike [str ] | None = None ,
165169 ssl_keyfile_password : str | None = None ,
@@ -188,16 +192,19 @@ def __init__(
188192 path : str = eventsub_path .removeprefix ("/" ).removesuffix ("/" ) if eventsub_path else "callback"
189193 self ._eventsub_path : str = f"/{ path } "
190194
191- opath : str = redirect_path .removeprefix ("/" ).removesuffix ("/" ) if redirect_path else "oauth/callback"
192- self ._redirect_path : str = f"/{ opath } "
195+ rpath : str = redirect_path .removeprefix ("/" ).removesuffix ("/" ) if redirect_path else "oauth/callback"
196+ self ._redirect_path : str = f"/{ rpath } "
197+
198+ opath : str = oauth_path .removeprefix ("/" ).removesuffix ("/" ) if oauth_path else "oauth"
199+ self ._oauth_path : str = f"/{ opath } "
193200
194201 self ._runner_task : asyncio .Task [None ] | None = None
195202 self ._responded : deque [str ] = deque (maxlen = 5000 )
196203
197204 super ().__init__ (
198205 routes = [
199206 Route (self ._redirect_path , self .oauth_callback , methods = ["GET" ]),
200- Route ("/oauth" , self .oauth_redirect , methods = ["GET" ]),
207+ Route (self . _oauth_path , self .oauth_redirect , methods = ["GET" ]),
201208 Route (self ._eventsub_path , self .eventsub_callback , methods = ["POST" ]),
202209 ],
203210 on_shutdown = [self .event_shutdown ],
0 commit comments