Google 로그인 웹
이 설정 프롬프트를 설치 단계와 이 플러그인의 전체 마크다운 가이드와 함께 복사합니다.
이 가이드에서, Google 로그인과 Capgo Social Login을 사용하여 웹 애플리케이션을 설정하는 방법을 배웁니다. 이미 일반 설정 가이드를 읽으셨다고 가정합니다. 웹에서 Google 로그인을 사용하는 방법.
일반 설정 가이드
구글 로그인 웹 사용웹에서 구글 로그인을 사용하는 것은 비교적 간단합니다. 웹에서 구글 로그인을 사용하려면 다음 단계를 수행해야 합니다.
-
Google Console에서 웹 클라이언트를 생성합니다.
-
검색 바를 클릭합니다.
-
검색어를 입력하고
credentials선택 (스크린샷의 2번째 옵션)APIs and ServicesAPIs 및 Services가 강조된 자격 증명 옵션을 보여주는 검색 결과
-
클릭하여
create credentials
-
선택하세요
OAuth client ID
-
선택하세요
Application typeWeb 옵션을 선택Web application
-
클라이언트 ID를 복사하세요
Create
-
클라이언트 ID를 복사하여
webClientId클라이언트 ID를 복사하여
-
-
Google Console에서 웹 클라이언트를 구성하세요.
-
아래의 인증 정보 페이지 웹 클라이언트를 클릭하세요.
-
이제,
Authorized JavaScript origins에 추가하세요. 이에는 앱을 사용할 수 있는 모든 주소가 포함되어야 합니다. 예를 들어, 사용하지 마세요. 사용하지 마세요.http://localhost이 두 주소를 모두 추가해야 합니다.http://localhost:5173-
인증된 자바스크립트 원본 섹션에 ADD URI 버튼을 클릭하세요.
add URI
-
URL을 입력해 주세요.
-
모든 URL을 추가할 때까지 반복해 주세요.
-
완료되면 화면이 다음과 같이 보일 것입니다.
-
-
다음과 같이 몇 가지를 추가해 주세요.
Authorized redirect URIsCapacitorSocialLogin 플러그인을 사용할 페이지에 따라 달라질 것입니다. 나의 경우는http://localhost:5173/auth-
CapacitorSocialLogin 플러그인을 사용할 페이지를 클릭해 주세요.
ADD URI
-
URL을 입력하고
ADD URL클릭해 주세요.
-
-
클릭
save
-
-
현재, 자바스크립트에서 호출할 준비가 되었어야 합니다.
login자바스크립트에서 호출하는 방법은 다음과 같습니다:-
먼저, 다음을 import하세요
SocialLoginimport { SocialLogin } from '@capgo/capacitor-social-login'; -
이니셜라이즈를 호출하세요. 이 함수는 단 한번만 호출해야 합니다.
// onMounted is Vue specific// webClientId is the client ID you got in the web client creation step not the android client ID.onMounted(() => {SocialLogin.initialize({google: {webClientId: '673324426943-avl4v9ubdas7a0u7igf7in03pdj1dkmg.apps.googleusercontent.com',}})})
-
로그인 버튼을 생성하여 클릭 시
SocialLogin.login호출하세요.const res = await SocialLogin.login({provider: 'google',options: {}})// Handle the responseconsole.log(JSON.stringify(res));
-
구글 로그인 웹에서 계속
구글 로그인 웹에서 계속이러한 기능을 사용 중이라면 구글 로그인 웹 인증 및 계정 흐름을 계획하고자 할 때, Using @capgo/capacitor-social-login Using @capgo/capacitor-social-login Using @capgo/capacitor-social-login Using @capgo/capacitor-passkey Using @capgo/capacitor-passkey Using @capgo/capacitor-passkey @capgo/capacitor-native-biometric for the implementation detail in @capgo/capacitor-native-biometric, and 두 단계 인증 두 단계 인증 구현 세부 사항