@@ -919,11 +919,6 @@ function checkCurrentUser () {
919919}
920920*/
921921
922- // HACK this global variable exists to prevent authSession.handleIncomingRedirect
923- // From being called twice. It would not be needed if it automatically redirected
924- // by iteself. See https://github.com/inrupt/solid-client-authn-js/issues/514
925- let checkingRedirect = false
926-
927922/**
928923 * Retrieves currently logged in webId from either
929924 * defaultTestUser or SolidAuth
@@ -937,24 +932,11 @@ export async function checkUser<T> (
937932 /**
938933 * Handle a successful authentication redirect
939934 */
940- // HACK normally you wouldn't need to do a check to see if 'code' is in the
941- // query, but it was removed from solid-client-authn-js
942- // See https://github.com/inrupt/solid-client-authn-js/issues/421
943- // Remove this after
944- const authCode = new URL ( window . location . href ) . searchParams . get ( 'code' )
945- if ( authCode && ! checkingRedirect ) {
946- checkingRedirect = true
947- // Being redirected after requesting a token
948- await authSession
949- . handleIncomingRedirect ( window . location . href )
950- // HACK solid-client-authn-js should automatically remove code and state
951- // from the URL, but it doesn't, so we do it manually here
952- // see https://github.com/inrupt/solid-client-authn-js/issues/514
953- const newPageUrl = new URL ( window . location . href )
954- newPageUrl . searchParams . delete ( 'code' )
955- newPageUrl . searchParams . delete ( 'state' )
956- window . history . replaceState ( { } , '' , newPageUrl . toString ( ) )
957- }
935+ await authSession
936+ . handleIncomingRedirect ( {
937+ restorePreviousSession : true ,
938+ url : window . location . href
939+ } )
958940
959941 // Check to see if already logged in / have the WebID
960942 let me = defaultTestUser ( )
0 commit comments