File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,8 +7,12 @@ import { apiRequest } from '../'
77export const userAuth = {
88 signOut : async ( ) => await apiRequest . get ( 'auth/signout' ) . json < void > ( ) ,
99
10- callback : async ( code : string ) =>
11- await apiRequest . get ( `auth/callback?code=${ code } ` ) . json < OAuthCallbackResponse > ( ) ,
10+ callback : async ( code : string ) => {
11+ const frontendOrigin = window . env . VITE_APP_URL || window . location . origin
12+ return await apiRequest
13+ . get ( `auth/callback?code=${ code } &redirect_uri=${ encodeURIComponent ( frontendOrigin ) } ` )
14+ . json < OAuthCallbackResponse > ( )
15+ } ,
1216
1317 whoAmI : ( isLoggedOut : boolean ) =>
1418 useQuery (
Original file line number Diff line number Diff line change @@ -175,8 +175,9 @@ export const AuthProvider = ({ children }: { children: React.ReactNode }) => {
175175 const currentUrl = location . pathname + location . searchStr
176176 setStoredRedirectUrl ( currentUrl )
177177
178+ const frontendOrigin = window . env . VITE_APP_URL || window . location . origin
178179 const oauthBaseUrl = window . env . VITE_SERVER_OAUTH_URL
179- const loginUrl = `?redirect=${ encodeURIComponent ( currentUrl ) } `
180+ const loginUrl = `?redirect=${ encodeURIComponent ( currentUrl ) } &redirect_uri= ${ encodeURIComponent ( frontendOrigin ) } `
180181
181182 try {
182183 const oauthApi = createApiWithBaseUrl ( oauthBaseUrl )
You can’t perform that action at this time.
0 commit comments