Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@openmobilehub/auth-google

Package Overview
Dependencies
Maintainers
0
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@openmobilehub/auth-google

React Native OMH Auth - Google (GMS/non-GMS) streamlines Google authentication integration into React Native applications, accommodating both GMS and non-GMS devices.

  • 1.0.0-beta.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
decreased by-66.67%
Maintainers
0
Weekly downloads
 
Created
Source


React Native OMH Auth - Google (GMS/non-GMS)

NPM downloads NPM version License

Chat on Discord Follow on Twitter


Installation

npm add @openmobilehub/auth-google

Configuration

To access Google APIs, please follow these steps in order to obtain the Client ID:

Console App

  1. Create a new app in Google Cloud.
  2. Create an OAuth 2.0 Client ID Android application and specify your Package Name and SHA1 Fingerprint for your app.

Android

Add a new entry to your android/local.properties file:

GOOGLE_CLIENT_ID=<YOUR_GOOGLE_CLIENT_ID>

iOS

Add a new entry to your .env file:

GOOGLE_CLIENT_ID=<YOUR_GOOGLE_CLIENT_ID>

Usage

Initializing

Before interacting with Google, initialization of the Google Auth Client is necessary, requiring platform specific configuration to be set.

import GoogleAuthClient from '@openmobilehub/auth-google';

await GoogleAuth.initialize({
  android: {
    scopes: ['openid', 'profile', 'email'],
  },
  ios: {
    scopes: ['openid', 'profile', 'email'],
    clientId: process.env.GOOGLE_CLIENT_ID,
    redirectUrl: `com.googleusercontent.apps.${
      process.env.GOOGLE_CLIENT_ID.split('.')[0]
    }:/oauth2redirect/google`,
  },
});

Other methods

:::warning[KNOWN LIMITATIONS]

On a GMS enabled device, Google SDK automatically refreshes the access token in the background. Refreshing the access token manually on a GMS enabled device is not supported as of now. Instead the current access token will be returned when calling the refreshAccessToken method.

:::

Interacting with the Google provider follows the same pattern as other providers since they all implement the IAuthModule interface. For a comprehensive list of available methods, refer to the Quick Start guide.

License

FAQs

Package last updated on 17 May 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc