1.0.6 • Published 10 months ago

@openmobilehub/auth-google v1.0.6

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
10 months ago

Installation

npm add @openmobilehub/auth-google

Configuration

:::infoPrerequisites

Each plugin requires you to follow the iOS and Android configuration prior to interacting with it.

:::

Console App

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

  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>

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'],
    webClientId: GOOGLE_WEB_CLIENT_ID,
  },
  ios: {
    scopes: ['openid', 'profile', 'email'],
    clientId: '<YOUR_GOOGLE_CLIENT_ID>',
    redirectUrl: `com.googleusercontent.apps.${
      '<YOUR_GOOGLE_CLIENT_ID>'.split('.')[0]
    }:/oauth2redirect/google`,
  },
});

Other methods

:::warningKNOWN 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

1.0.6

10 months ago

1.0.5

10 months ago

1.0.4-alpha.0

11 months ago

1.0.3

11 months ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago

1.0.0-beta.4

1 year ago

1.0.0-beta.3

1 year ago

1.0.0-beta.2

1 year ago

1.0.0-beta.1

1 year ago

1.0.0-beta.0

1 year ago