diff --git a/src/features/app/App.tsx b/src/features/app/App.tsx
index 9c8aba3..4598055 100644
--- a/src/features/app/App.tsx
+++ b/src/features/app/App.tsx
@@ -10,6 +10,7 @@ import { PrivacyPolicy } from '@/features/app/PrivacyPolicy';
import { Download } from '@/features/app/Download';
import { AuthElectronGoogle } from '@/features/app/AuthElectronGoogle';
import { AuthElectronApple } from '@/features/app/AuthElectronApple';
+import { AuthElectronRedirect } from '@/features/app/AuthElectronRedirect';
import { ModalDialog } from '@/features/common/ModalDialog';
import { InputDialog } from '@/features/common/InputDialog';
@@ -42,6 +43,7 @@ export default function App() {
} />
} />
} />
+ } />
} />
diff --git a/src/features/app/AuthElectronApple.tsx b/src/features/app/AuthElectronApple.tsx
index 3d188ca..de8e76f 100644
--- a/src/features/app/AuthElectronApple.tsx
+++ b/src/features/app/AuthElectronApple.tsx
@@ -1,5 +1,5 @@
import { useEffect } from 'react';
-import { getAuth, signInWithRedirect, OAuthProvider } from 'firebase/auth';
+import { getAuth, signInWithRedirect, OAuthProvider, getRedirectResult } from 'firebase/auth';
const authProvider = localStorage.getItem('auth_provider');
@@ -9,6 +9,13 @@ export const AuthElectronApple = () => {
localStorage.removeItem('auth_provider');
return;
}
+ getRedirectResult(getAuth()).then((result) => {
+ if (result) {
+ const credential = OAuthProvider.credentialFromResult(result);
+ const url = '/auth/redirect?credential=' + JSON.stringify(credential);
+ window.location.href = url;
+ }
+ });
const provider = new OAuthProvider('apple.com');
const auth = getAuth();
localStorage.setItem('auth_provider', 'apple');
diff --git a/src/features/app/AuthElectronGoogle.tsx b/src/features/app/AuthElectronGoogle.tsx
index 96149e5..e462fbc 100644
--- a/src/features/app/AuthElectronGoogle.tsx
+++ b/src/features/app/AuthElectronGoogle.tsx
@@ -1,5 +1,5 @@
import { useEffect } from 'react';
-import { getAuth, signInWithRedirect, GoogleAuthProvider } from 'firebase/auth';
+import { getAuth, signInWithRedirect, GoogleAuthProvider, getRedirectResult } from 'firebase/auth';
const authProvider = localStorage.getItem('auth_provider');
@@ -9,6 +9,14 @@ export const AuthElectronGoogle = () => {
localStorage.removeItem('auth_provider');
return;
}
+ getRedirectResult(getAuth()).then((result) => {
+ if (result) {
+ const credential = GoogleAuthProvider.credentialFromResult(result);
+ const url = '/auth/redirect?credential=' + JSON.stringify(credential);
+ window.location.href = url;
+ }
+ });
+
const provider = new GoogleAuthProvider();
const auth = getAuth();
localStorage.setItem('auth_provider', 'google');
diff --git a/src/features/app/AuthElectronRedirect.tsx b/src/features/app/AuthElectronRedirect.tsx
new file mode 100644
index 0000000..d95f38e
--- /dev/null
+++ b/src/features/app/AuthElectronRedirect.tsx
@@ -0,0 +1,3 @@
+export const AuthElectronRedirect = () => {
+ return <>ログインが完了しました。>;
+};