0.0.20240508 • Published 7 days ago

@maxim_mazurok/gapi.client.identitytoolkit-v1 v0.0.20240508

Weekly downloads
-
License
MIT
Repository
github
Last release
7 days ago

TypeScript typings for Identity Toolkit API v1

The Google Identity Toolkit API lets you use open standards to verify a user's identity. For detailed description please check documentation.

Installing

Install typings for Identity Toolkit API:

npm install @types/gapi.client.identitytoolkit-v1 --save-dev

Usage

You need to initialize Google API client in your code:

gapi.load('client', () => {
  // now we can use gapi.client
  // ...
});

Then load api client wrapper:

gapi.client.load(
  'https://identitytoolkit.googleapis.com/$discovery/rest?version=v1',
  () => {
    // now we can use:
    // gapi.client.identitytoolkit
  }
);
// Deprecated, use discovery document URL, see https://github.com/google/google-api-javascript-client/blob/master/docs/reference.md#----gapiclientloadname----version----callback--
gapi.client.load('identitytoolkit', 'v1', () => {
  // now we can use:
  // gapi.client.identitytoolkit
});

Don't forget to authenticate your client before sending any request to resources:

// declare client_id registered in Google Developers Console
var client_id = '',
  scope = [
    // See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account.
    'https://www.googleapis.com/auth/cloud-platform',

    // View and administer all your Firebase data and settings
    'https://www.googleapis.com/auth/firebase',
  ],
  immediate = true;
// ...

gapi.auth.authorize(
  {client_id: client_id, scope: scope, immediate: immediate},
  authResult => {
    if (authResult && !authResult.error) {
      /* handle successful authorization */
    } else {
      /* handle authorization error */
    }
  }
);

After that you can use Identity Toolkit API resources:

/*
If an email identifier is specified, checks and returns if any user account is registered with the email. If there is a registered account, fetches all providers associated with the account's email. If the provider ID of an Identity Provider (IdP) is specified, creates an authorization URI for the IdP. The user can be directed to this URI to sign in with the IdP. An [API key](https://cloud.google.com/docs/authentication/api-keys) is required in the request in order to identify the Google Cloud project.
*/
await gapi.client.identitytoolkit.accounts.createAuthUri({});

/*
Deletes a user's account.
*/
await gapi.client.identitytoolkit.accounts.delete({});

/*
Experimental
*/
await gapi.client.identitytoolkit.accounts.issueSamlResponse({});

/*
Gets account information for all matched accounts. For an end user request, retrieves the account of the end user. For an admin request with Google OAuth 2.0 credential, retrieves one or multiple account(s) with matching criteria.
*/
await gapi.client.identitytoolkit.accounts.lookup({});

/*
Resets the password of an account either using an out-of-band code generated by sendOobCode or by specifying the email and password of the account to be modified. Can also check the purpose of an out-of-band code without consuming it.
*/
await gapi.client.identitytoolkit.accounts.resetPassword({});

/*
Sends an out-of-band confirmation code for an account. Requests from a authenticated request can optionally return a link including the OOB code instead of sending it.
*/
await gapi.client.identitytoolkit.accounts.sendOobCode({});

/*
Sends a SMS verification code for phone number sign-in. To localize the text of the SMS sent to the user, set the HTTP header `X-Firebase-Locale` to the language code that corresponds with the user's locale. An [API key](https://cloud.google.com/docs/authentication/api-keys) is required in the request in order to identify the Google Cloud project.
*/
await gapi.client.identitytoolkit.accounts.sendVerificationCode({});

/*
Signs in or signs up a user by exchanging a custom Auth token. Upon a successful sign-in or sign-up, a new Identity Platform ID token and refresh token are issued for the user. An [API key](https://cloud.google.com/docs/authentication/api-keys) is required in the request in order to identify the Google Cloud project.
*/
await gapi.client.identitytoolkit.accounts.signInWithCustomToken({});

/*
Signs in or signs up a user with a out-of-band code from an email link. If a user does not exist with the given email address, a user record will be created. If the sign-in succeeds, an Identity Platform ID and refresh token are issued for the authenticated user. An [API key](https://cloud.google.com/docs/authentication/api-keys) is required in the request in order to identify the Google Cloud project.
*/
await gapi.client.identitytoolkit.accounts.signInWithEmailLink({});

/*
Signs in or signs up a user with iOS Game Center credentials. If the sign-in succeeds, a new Identity Platform ID token and refresh token are issued for the authenticated user. The bundle ID is required in the request header as `x-ios-bundle-identifier`. An [API key](https://cloud.google.com/docs/authentication/api-keys) is required in the request in order to identify the Google Cloud project. Apple has [deprecated the `playerID` field](https://developer.apple.com/documentation/gamekit/gkplayer/1521127-playerid/). The Apple platform Firebase SDK will use `gamePlayerID` and `teamPlayerID` from version 10.5.0 and onwards. Upgrading to SDK version 10.5.0 or later updates existing integrations that use `playerID` to instead use `gamePlayerID` and `teamPlayerID`. When making calls to `signInWithGameCenter`, you must include `playerID` along with the new fields `gamePlayerID` and `teamPlayerID` to successfully identify all existing users. Upgrading existing Game Center sign in integrations to SDK version 10.5.0 or later is irreversible.
*/
await gapi.client.identitytoolkit.accounts.signInWithGameCenter({});

/*
Signs in or signs up a user using credentials from an Identity Provider (IdP). This is done by manually providing an IdP credential, or by providing the authorization response obtained via the authorization request from CreateAuthUri. If the sign-in succeeds, a new Identity Platform ID token and refresh token are issued for the authenticated user. A new Identity Platform user account will be created if the user has not previously signed in to the IdP with the same account. In addition, when the "One account per email address" setting is enabled, there should not be an existing Identity Platform user account with the same email address for a new user account to be created. An [API key](https://cloud.google.com/docs/authentication/api-keys) is required in the request in order to identify the Google Cloud project.
*/
await gapi.client.identitytoolkit.accounts.signInWithIdp({});

/*
Signs in a user with email and password. If the sign-in succeeds, a new Identity Platform ID token and refresh token are issued for the authenticated user. An [API key](https://cloud.google.com/docs/authentication/api-keys) is required in the request in order to identify the Google Cloud project.
*/
await gapi.client.identitytoolkit.accounts.signInWithPassword({});

/*
Completes a phone number authentication attempt. If a user already exists with the given phone number, an ID token is minted for that user. Otherwise, a new user is created and associated with the phone number. This method may also be used to link a phone number to an existing user. To localize the text of the SMS sent to the user, set the HTTP header `X-Firebase-Locale` to the language code that corresponds with the user's locale. An [API key](https://cloud.google.com/docs/authentication/api-keys) is required in the request in order to identify the Google Cloud project.
*/
await gapi.client.identitytoolkit.accounts.signInWithPhoneNumber({});

/*
Signs up a new email and password user or anonymous user, or upgrades an anonymous user to email and password. For an admin request with a Google OAuth 2.0 credential with the proper [permissions](https://cloud.google.com/identity-platform/docs/access-control), creates a new anonymous, email and password, or phone number user. An [API key](https://cloud.google.com/docs/authentication/api-keys) is required in the request in order to identify the Google Cloud project.
*/
await gapi.client.identitytoolkit.accounts.signUp({});

/*
Updates account-related information for the specified user by setting specific fields or applying action codes. Requests from administrators and end users are supported.
*/
await gapi.client.identitytoolkit.accounts.update({});

/*
Verifies an iOS client is a real iOS device. If the request is valid, a receipt will be sent in the response and a secret will be sent via Apple Push Notification Service. The client should send both of them back to certain Identity Platform APIs in a later call (for example, /accounts:sendVerificationCode), in order to verify the client. The bundle ID is required in the request header as `x-ios-bundle-identifier`. An [API key](https://cloud.google.com/docs/authentication/api-keys) is required in the request in order to identify the Google Cloud project.
*/
await gapi.client.identitytoolkit.accounts.verifyIosClient({});

/*
Signs up a new email and password user or anonymous user, or upgrades an anonymous user to email and password. For an admin request with a Google OAuth 2.0 credential with the proper [permissions](https://cloud.google.com/identity-platform/docs/access-control), creates a new anonymous, email and password, or phone number user. An [API key](https://cloud.google.com/docs/authentication/api-keys) is required in the request in order to identify the Google Cloud project.
*/
await gapi.client.identitytoolkit.projects.accounts({
  targetProjectId: 'targetProjectId',
});

/*
Creates a session cookie for the given Identity Platform ID token. The session cookie is used by the client to preserve the user's login state.
*/
await gapi.client.identitytoolkit.projects.createSessionCookie({
  targetProjectId: 'targetProjectId',
});

/*
Looks up user accounts within a project or a tenant based on conditions in the request.
*/
await gapi.client.identitytoolkit.projects.queryAccounts({
  targetProjectId: 'targetProjectId',
});

/*
Gets a project's public Identity Toolkit configuration. (Legacy) This method also supports authenticated calls from a developer to retrieve non-public configuration.
*/
await gapi.client.identitytoolkit.getProjects({});

/*
Retrieves public keys of the legacy Identity Toolkit token signer to enable third parties to verify the legacy ID token. For now the X509 pem cert is the only format supported.
*/
await gapi.client.identitytoolkit.getPublicKeys({});

/*
Gets parameters needed for generating a reCAPTCHA challenge.
*/
await gapi.client.identitytoolkit.getRecaptchaParams({});

/*
Retrieves the set of public keys of the session cookie JSON Web Token (JWT) signer that can be used to validate the session cookie created through createSessionCookie.
*/
await gapi.client.identitytoolkit.getSessionCookiePublicKeys({});
0.0.20240508

7 days ago

0.0.20240501

14 days ago

0.0.20240424

24 days ago

0.0.20240417

27 days ago

0.0.20240415

1 month ago

0.0.20240319

2 months ago

0.0.20240313

2 months ago

0.0.20240307

2 months ago

0.0.20240228

3 months ago

0.0.20240220

3 months ago

0.0.20240212

3 months ago

0.0.20240201

4 months ago

0.0.20240118

4 months ago

0.0.20240116

4 months ago

0.0.20240103

4 months ago

0.0.20230812

9 months ago

0.0.20231111

6 months ago

0.0.20230729

10 months ago

0.0.20230721

10 months ago

0.0.20230804

10 months ago

0.0.20230923

8 months ago

0.0.20231020

7 months ago

0.0.20231027

7 months ago

0.0.20231103

7 months ago

0.0.20230916

8 months ago

0.0.20231007

7 months ago

0.0.20230714

10 months ago

0.0.20231016

7 months ago

0.0.20230707

11 months ago

0.0.20230901

9 months ago

0.0.20231002

8 months ago

0.0.20230627

11 months ago

0.0.20230613

11 months ago

0.0.20230610

11 months ago

0.0.20230516

1 year ago

0.0.20230520

12 months ago

0.0.20230508

1 year ago

0.0.20230429

1 year ago

0.0.20230505

1 year ago

0.0.20230531

12 months ago

0.0.20230414

1 year ago

0.0.20230318

1 year ago

0.0.20230421

1 year ago

0.0.20230224

1 year ago

0.0.20230304

1 year ago

0.0.20230327

1 year ago

0.0.20230228

1 year ago

0.0.20230401

1 year ago

0.0.20230410

1 year ago

0.0.20230311

1 year ago

0.0.20230128

1 year ago

0.0.20230204

1 year ago

0.0.20230218

1 year ago

0.0.20230220

1 year ago

0.0.20230211

1 year ago

0.0.20230107

1 year ago

0.0.20221104

2 years ago

0.0.20221112

2 years ago

0.0.20230121

1 year ago

0.0.20230124

1 year ago

0.0.20230113

1 year ago

0.0.20230102

1 year ago

0.0.20221206

1 year ago

0.0.20221029

2 years ago

0.0.20221021

2 years ago

0.0.20221015

2 years ago

0.0.20220924

2 years ago