|
1 | | -"use client"; |
| 1 | +import type { Metadata } from "next"; |
| 2 | +import OAuthProcessor from "./OAuthProcessor"; |
2 | 3 |
|
3 | | -import { useEffect } from "react"; |
| 4 | +export const metadata: Metadata = { |
| 5 | + robots: "noindex, nofollow", |
| 6 | +}; |
4 | 7 |
|
5 | 8 | export default function GoogleOAuthPage() { |
6 | | - useEffect(() => { |
7 | | - // Get current URL parameters |
8 | | - const urlParams = new URLSearchParams(window.location.search); |
9 | | - |
10 | | - // Extract state and code from current URL |
11 | | - const state = urlParams.get("state"); |
12 | | - const code = urlParams.get("code"); |
13 | | - |
14 | | - if (state && code) { |
15 | | - try { |
16 | | - // Parse the StorageOauthDto from the state parameter |
17 | | - const oauthDto = JSON.parse(decodeURIComponent(state)); |
18 | | - |
19 | | - // Update the authCode field with the received code |
20 | | - oauthDto.authCode = code; |
21 | | - |
22 | | - // Construct the redirect URL with the updated DTO |
23 | | - const redirectUrl = `${ |
24 | | - oauthDto.redirectUrl |
25 | | - }?oauthDto=${encodeURIComponent(JSON.stringify(oauthDto))}`; |
26 | | - |
27 | | - // Redirect to the constructed URL |
28 | | - window.location.href = redirectUrl; |
29 | | - } catch (error) { |
30 | | - console.error("Error parsing state parameter:", error); |
31 | | - } |
32 | | - } else { |
33 | | - console.error("Missing state or code parameter"); |
34 | | - } |
35 | | - }, []); |
36 | | - |
37 | | - return ( |
38 | | - <div |
39 | | - style={{ |
40 | | - textAlign: "center", |
41 | | - padding: "50px", |
42 | | - fontFamily: "Arial, sans-serif", |
43 | | - }} |
44 | | - > |
45 | | - <h2>Processing OAuth...</h2> |
46 | | - <p>Please wait while we redirect you back to the application.</p> |
47 | | - </div> |
48 | | - ); |
| 9 | + return <OAuthProcessor />; |
49 | 10 | } |
0 commit comments