### Build and Run iOS App Source: https://github.com/patrickkabwe/react-native-nitro-google-sso/blob/main/example/README.md Builds and runs the React Native application on an iOS simulator or device. This command requires the Metro bundler to be running and CocoaPods dependencies to be installed. ```sh # Using npm npm run ios # OR using Yarn yarn ios ``` -------------------------------- ### Install CocoaPods Dependencies Source: https://github.com/patrickkabwe/react-native-nitro-google-sso/blob/main/example/README.md Installs or updates native dependencies for iOS projects using CocoaPods. This is typically run once after cloning or updating native modules. ```sh # Install CocoaPods itself (if not already installed) bundle install # Install/update project dependencies bundle exec pod install ``` -------------------------------- ### Start Metro Bundler Source: https://github.com/patrickkabwe/react-native-nitro-google-sso/blob/main/example/README.md Starts the Metro JavaScript bundler, which is essential for developing React Native applications. It supports both npm and Yarn package managers. ```sh # Using npm npm start # OR using Yarn yarn start ``` -------------------------------- ### Build and Run Android App Source: https://github.com/patrickkabwe/react-native-nitro-google-sso/blob/main/example/README.md Builds and runs the React Native application on an Android device or emulator. This command requires the Metro bundler to be running. ```sh # Using npm npm run android # OR using Yarn yarn android ``` -------------------------------- ### Install React Native Nitro Google SSO Source: https://github.com/patrickkabwe/react-native-nitro-google-sso/blob/main/README.md Installs the react-native-nitro-google-sso module and its dependency react-native-nitro-modules using common package managers like bun, npm, or yarn. ```bash bun add react-native-nitro-google-sso react-native-nitro-modules ``` ```bash npm install react-native-nitro-google-sso ``` ```bash yarn add react-native-nitro-google-sso ``` -------------------------------- ### CMake Configuration for Nitro Google SSO Source: https://github.com/patrickkabwe/react-native-nitro-google-sso/blob/main/android/CMakeLists.txt This CMake script configures the build process for the Nitro Google SSO native library. It sets up the minimum required CMake version, defines the package name, specifies C++ standards, adds the library sources, includes local and generated headers, finds necessary libraries like liblog, and links them together for the Android platform. ```cmake project(NitroGoogleSso) cmake_minimum_required(VERSION 3.9.0) set (PACKAGE_NAME NitroGoogleSso) set (CMAKE_VERBOSE_MAKEFILE ON) set (CMAKE_CXX_STANDARD 20) # Define C++ library and add all sources add_library(${PACKAGE_NAME} SHARED src/main/cpp/cpp-adapter.cpp ) # Add Nitrogen specs :) include(${CMAKE_SOURCE_DIR}/../nitrogen/generated/android/NitroGoogleSso+autolinking.cmake) # Set up local includes include_directories( "src/main/cpp" "../cpp" ) find_library(LOG_LIB log) # Link all libraries together target_link_libraries( ${PACKAGE_NAME} ${LOG_LIB} android # <-- Android core ) ``` -------------------------------- ### Google Sign-In Methods Source: https://github.com/patrickkabwe/react-native-nitro-google-sso/blob/main/README.md Provides methods for user authentication with Google, including initiating a sign-in flow, handling one-tap sign-in, retrieving the current user, and signing out. ```APIDOC NitroGoogleSSO: configure(config: NitroGoogleSSOConfig): void Configures the Google Sign-In module with provided credentials. Parameters: config: An object containing configuration details. - iosClientId (string): Your iOS Client ID from Google Cloud Console. - webClientId (string): Your Web Client ID from Google Cloud Console. - nonce (string, optional): A security nonce for enhanced protection. - hostedDomain (string, optional): Restricts sign-in to users within a specified domain. signIn(): Promise Initiates the standard Google Sign-In flow. Returns: A Promise that resolves with user information upon successful sign-in, or null if the user cancels. Throws: Errors related to network issues, invalid configuration, or authentication failures. oneTapSignIn(): Promise Initiates the Google One-Tap Sign-In flow for a seamless experience. Returns: A Promise that resolves with user information upon successful sign-in, or null if the user cancels. Throws: Errors related to network issues, invalid configuration, or authentication failures. getCurrentUser(): Promise Retrieves information about the currently signed-in user. Returns: A Promise that resolves with the current user's information, or null if no user is signed in. Throws: Errors if there's an issue fetching user data. signOut(): Promise Signs out the currently authenticated user. Returns: A Promise that resolves when the user is successfully signed out. Throws: Errors if the sign-out process fails. ``` ```typescript // Usage Example: Sign In try { const user = await NitroGoogleSSO.signIn() if (user) { console.log('User signed in:', user) } else { console.log('User cancelled sign in') } } catch (error) { console.error('Sign in error:', error) } ``` ```typescript // Usage Example: One Tap Sign In try { const user = await NitroGoogleSSO.oneTapSignIn() if (user) { console.log('User signed in:', user) } else { console.log('User cancelled sign in') } } catch (error) { console.error('Sign in error:', error) } ``` ```typescript // Usage Example: Get Current User try { const user = await NitroGoogleSSO.getCurrentUser() if (user) { console.log('Current user:', user) } else { console.log('No user is signed in') } } catch (error) { console.error('Error getting current user:', error) } ``` ```typescript // Usage Example: Sign Out try { await NitroGoogleSSO.signOut() console.log('User signed out successfully') } catch (error) { console.error('Sign out error:', error) } ``` -------------------------------- ### Type Definitions Source: https://github.com/patrickkabwe/react-native-nitro-google-sso/blob/main/README.md Defines the expected structure for configuration objects and user information returned by the module. ```APIDOC NitroGoogleSSOConfig: An interface defining the configuration options for the NitroGoogleSSO module. Properties: iosClientId (string): Required. The iOS Client ID obtained from Google Cloud Console. webClientId (string): Required. The Web Client ID obtained from Google Cloud Console. nonce (string, optional): An optional security nonce string. hostedDomain (string, optional): An optional string to restrict sign-in to a specific domain. NitroGoogleUserInfo: An interface representing the user information returned after a successful sign-in. The exact properties may vary based on the requested scopes during sign-in. Common properties might include: idToken (string): The ID token for the authenticated user. accessToken (string): The access token for the authenticated user. email (string): The user's email address. name (string): The user's full name. givenName (string): The user's first name. familyName (string): The user's last name. photoUrl (string): The URL to the user's profile picture. ``` -------------------------------- ### Configure NitroGoogleSSO Module Source: https://github.com/patrickkabwe/react-native-nitro-google-sso/blob/main/README.md Configures the NitroGoogleSSO module with necessary client IDs and an optional nonce. This should be done early in the application's lifecycle. ```typescript import NitroGoogleSSO from 'react-native-nitro-google-sso' // Configure the module NitroGoogleSSO.configure({ iosClientId: 'YOUR_IOS_CLIENT_ID', webClientId: 'YOUR_WEB_CLIENT_ID', nonce: 'YOUR_NONCE', // Optional security nonce hostedDomain: 'example.com' // Optional: Restrict sign-in to a specific domain }) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.