내용으로 건너뛰기

안드로이드에서 Supabase Google 로그인

GitHub

소개

소개

이 가이드는 Android에서 Google Sign-In을 Supabase Authentication과 통합하는 데 도움이 됩니다. 이미 완료한 것으로 가정합니다:

구현은 예제 앱의

example app’s

The complete implementation is available in the example app’s supabaseAuthUtils.ts 파일. 이 안내서에서는 주요 개념과 사용 방법을 설명합니다.

인증 도우미 사용

인증 도우미 사용 방법

The authenticateWithGoogleSupabase 함수는 전체 인증 흐름을 처리합니다.

import { authenticateWithGoogleSupabase } from './supabaseAuthUtils';
const result = await authenticateWithGoogleSupabase();
if (result.success) {
console.log('Signed in:', result.user);
// Navigate to your authenticated area
} else {
console.error('Error:', result.error);
}

인증 흐름이 어떻게 작동하는지 자세히 설명하려면, 비공개 토큰 생성, JWT 검증, Supabase 로그인과 같은 항목을 포함하여 일반 설정 안내서의

인증 흐름이 어떻게 작동하는지 자세히 설명하려면, 비공개 토큰 생성, JWT 검증, Supabase 로그인과 같은 항목을 포함하여 일반 설정 안내서의

인증 흐름이 어떻게 작동하는지 자세히 설명하려면, 비공개 토큰 생성, JWT 검증, Supabase 로그인과 같은 항목을 포함하여 일반 설정 안내서의 인증 흐름이 어떻게 작동하는지 자세히 설명하려면, 비공개 토큰 생성, JWT 검증, Supabase 로그인과 같은 항목을 포함하여 일반 설정 안내서의.

For the complete code reference, see the Complete Code Reference section in the General Setup guide.

중요한 참고 사항

중요한 참고 사항 섹션

Nonce 구현은 React Native Google Sign In 문서에서 설명하는 패턴을 따릅니다. Google Sign-In을 통해 Supabase로 이동:

  • rawNonce Supabase는 signInWithIdToken()
  • 를 해시화합니다. rawNonce 그것을 nonceDigest 와 비교합니다.
  • nonceDigest Google Sign-In에서 제공하는 ID 토큰에 포함된 nonce (SHA-256 해시, 16진수 인코딩) Supabase로 이동합니다. ID 토큰의 parameter는 Google Sign-In API에서 제공합니다.

자동 재시도

자동 재시도 섹션

implementation에는 자동 재시도 논리가 포함됩니다.

  • 첫 번째 시도에서 JWT 검증이 실패하면 로그아웃하고 다시 시도합니다.
  • 캐시된 토큰이 잘못된 nonce를 가지고 있는 경우를 처리합니다.
  • 재시도도 실패하면 오류가 반환됩니다.

유효한 청중

  • : Google Client ID가 Google Cloud Console과 Supabase에서 일치하는지 확인하세요.nonce 일치하지 않음
  • Troubleshooting: 콘솔 로그를 확인하세요 - 함수는 자동으로 다시 시도하지만 필요할 경우 로그아웃을 수동으로 먼저 해보세요
  • 토큰 유효성 검사 실패: __CAPGO_KEEP_0__ 예제 앱을 참조하여 mode: 'online' Supabase Google 로그인 Android에서 사용 중인지 확인하세요
  • Supabase Google 로그인 Android example app code Section titled “Keep going from Supabase Google Login on Android”

to plan authentication and account flows, connect it with Review the example app __CAPGO_KEEP_0__ @capgo/capacitor-social-login native capability in @capgo/capacitor-social-login @capgo/capacitor-social-login implementation detail in @capgo/capacitor-social-login @capgo/capacitor-passkey implementation detail in @capgo/capacitor-passkey @capgo/capacitor-native-biometric implementation detail in @capgo/capacitor-native-biometric, Two-factor authentication implementation detail in Two-factor authentication 페이지 편집