Skip to content

Commit

Permalink
Merge pull request #53 from MaeumGaGym/feature/#34-auth
Browse files Browse the repository at this point in the history
fix google auth
  • Loading branch information
wjknnn authored Mar 11, 2024
2 parents 972928d + 15aca7e commit 46023b5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions service/main/src/app/@auth/(.)signin/LoginModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ import { useEffect } from 'react'

const client_id = '9435200486-cqvufkdfa44kuv50i0c52bco46o2big1.apps.googleusercontent.com'
const response_type = 'token'
const redirect_uri = 'http://localhost:3000/google/login'
const redirect_uri = 'https://maeumgagym-main-stag.xquare.app/google/login'
const scope = 'https://www.googleapis.com/auth/userinfo.email+https://www.googleapis.com/auth/userinfo.profile'

export const LoginModal = ({ nextStep, setData }: { nextStep: () => void; setData: (v: string) => void }) => {
const router = useRouter()
useEffect(() => {
localStorage.setItem('access_token', '')
const loginWithToken = async (e: { origin: string; data: string }) => {
if (e.origin === 'http://localhost:3000' && typeof e.data === 'string') {
if (e.origin === 'https://maeumgagym-main-stag.xquare.app' && typeof e.data === 'string') {
console.log(e.data)
localStorage.setItem('access_token', e.data)
if (await login(e.data)) {
Expand Down
2 changes: 1 addition & 1 deletion service/main/src/app/google/login/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default function GoogleLogin() {
useEffect(() => {
url = window.location.href
if (url) {
opener?.postMessage(url.match(/access_token=([^&]*)/)?.[1], 'http://localhost:3000')
opener?.postMessage(url.match(/access_token=([^&]*)/)?.[1], 'https://maeumgagym-main-stag.xquare.app')
window.close()
}
}, [])
Expand Down

0 comments on commit 46023b5

Please sign in to comment.