feat(example): add Google sign in demo and env setup#1
Merged
Conversation
|
Looks good overall. Is the Kotlin code something that we have to write and manage? Are there no existing SDKs for this? Or is the purpose of this project to create Kotlin and Swift based Social login experiences that can be plugged into an existing RN project? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Builds out a complete, runnable example app for the Google Sign-In package and hardens the Android native module with stable dependency versions. The example showcases every variant of the
GoogleSignInButton(themes, shapes, text, sizes, disabled state) and exercises the full public API (configure,signIn,signOut,GoogleSignInErrorCode,isGoogleSignInError). The Web Client ID is loaded from a.envfile via Expo's built-inEXPO_PUBLIC_*support so contributors can drop in their own credentials without editing source.Changes
Example app
example/src/App.tsx— replaced the placeholder demo with a stateful sign-in flow:GoogleSignIn.configure()+GoogleSignIn.signIn(), stores the returnedGoogleUser, and renders a profile view on successisGoogleSignInError()+ per-code branching (SIGN_IN_CANCELLED,NO_CREDENTIALS,PLAY_SERVICES_NOT_AVAILABLE)example/.env.example— checked-in template documenting the requiredEXPO_PUBLIC_GOOGLE_WEB_CLIENT_IDenv varexample/src/env.d.ts— small ambient declaration so TypeScript knows aboutprocess.env.EXPO_PUBLIC_GOOGLE_WEB_CLIENT_IDwithout pulling in@types/nodeexample/package.json— addsreact-native-svgso the example app can render theGoogleLogoSVG (the library declares it as a peer dependency).gitignore— ignores.env/.env.localwhile keeping.env.exampletrackedPublic API
src/index.tsx— exports the newGoogleSignInButtonShapeandGoogleSignInButtonTexttypes so consumers can type props they pass throughAndroid
android/build.gradle— pins to stable versions instead of alpha tags that weren't resolvable:androidx.credentials:credentials→1.5.0androidx.credentials:credentials-play-services-auth→1.5.0(was the unresolvable17.0-alpha01)com.google.android.libraries.identity.googleid:googleid→1.1.1Demo
screen-20260612-155543-1781276125097.mp4
Test plan
yarn typecheckpassesexample/.env.example→example/.envand fill in a real Web Client IDyarn workspace @thoughtbot/react-native-social-auth-example start --clearthenyarn androidcd example/android && ./gradlew :app:assembleDebugresolves all credentials/googleid deps (regression check for the version fix)displayName+email.env, restart Metro with--clear, tap sign-in → "Missing config" alert fires (graceful failure check)