@@ -66,6 +66,10 @@ function SpaceOAuthCallbackContent() {
6666 const [ searchParams ] = useSearchParams ( ) ;
6767 const { t } = useTranslation ( ) ;
6868 const isMountedRef = useRef ( true ) ;
69+ const directLaunchFragmentRef = useRef < {
70+ workspaceUuid : string | null ;
71+ launchAssertion : string | null ;
72+ } | null > ( null ) ;
6973
7074 const [ status , setStatus ] = useState <
7175 'loading' | 'confirm' | 'success' | 'error'
@@ -220,8 +224,29 @@ function SpaceOAuthCallbackContent() {
220224 const errorDescription = searchParams . get ( 'error_description' ) ;
221225 const mode = searchParams . get ( 'mode' ) ;
222226 const state = searchParams . get ( 'state' ) ;
223- const workspaceUuid = searchParams . get ( 'workspace_uuid' ) ;
224- const launchAssertion = searchParams . get ( 'launch_assertion' ) ;
227+ if ( directLaunchFragmentRef . current === null ) {
228+ const fragmentParams = new URLSearchParams (
229+ window . location . hash . startsWith ( '#' )
230+ ? window . location . hash . slice ( 1 )
231+ : window . location . hash ,
232+ ) ;
233+ directLaunchFragmentRef . current = {
234+ workspaceUuid : fragmentParams . get ( 'workspace_uuid' ) ,
235+ launchAssertion : fragmentParams . get ( 'launch_assertion' ) ,
236+ } ;
237+ if ( window . location . hash ) {
238+ window . history . replaceState (
239+ null ,
240+ '' ,
241+ `${ window . location . pathname } ${ window . location . search } ` ,
242+ ) ;
243+ }
244+ }
245+ const workspaceUuid =
246+ directLaunchFragmentRef . current . workspaceUuid ??
247+ searchParams . get ( 'workspace_uuid' ) ;
248+ const launchAssertion =
249+ directLaunchFragmentRef . current . launchAssertion ;
225250
226251 if ( error ) {
227252 setStatus ( 'error' ) ;
0 commit comments