# gitkitclient

> Google Identity Toolkit Client Library for Node.js

Latest version **0.0.7** (published 2016-04-27) · Apache 2 license · 0 weekly downloads

## Install

```sh
npm install gitkitclient
pnpm add gitkitclient
yarn add gitkitclient
bun add gitkitclient
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.7 |
| Published | 2016-04-27 |
| First published | 2014-11-03 |
| Weekly downloads | 0 |
| License | Apache 2 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 (+2 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 31 |
| Author | Google Inc. |
| Maintainers | jinliu, wyhao31 |
| Keywords | google, gitkit, identity, toolkit, client, client library |

## Links

- npm: https://www.npmjs.com/package/gitkitclient
- Repository: https://github.com/google/identity-toolkit-node-client
- Homepage: https://github.com/google/identity-toolkit-node-client#readme
- Issues: https://github.com/google/identity-toolkit-node-client/issues
- npm.io page: https://npm.io/package/gitkitclient

## Dependencies (3)

- [async](https://npm.io/package/async.md) ^1.5.2
- [request](https://npm.io/package/request.md) ^2.72.0
- [googleapis](https://npm.io/package/googleapis.md) ^5.2.1

## Alternatives

- [launchdarkly-js-client-sdk](https://npm.io/package/launchdarkly-js-client-sdk.md) — 2.5M weekly downloads
- [@elastic/elasticsearch](https://npm.io/package/@elastic/elasticsearch.md) — 2.1M weekly downloads
- [@c8y/client](https://npm.io/package/@c8y/client.md) — 15.3K weekly downloads
- [@signaldb/maverickjs](https://npm.io/package/@signaldb/maverickjs.md) — 1.7K weekly downloads
- [@bbc/http-transport-cache](https://npm.io/package/@bbc/http-transport-cache.md) — 1.2K weekly downloads

## Recent versions

- 0.0.7 (latest) — 2016-04-27
- 0.0.6 — 2016-03-04
- 0.0.5 — 2015-12-11
- 0.0.4 — 2015-08-12
- 0.0.3 — 2015-07-20
- 0.0.2 — 2014-11-03

## README

Google Identity Toolkit client library for Node.js

Sample usage
=====================

Initialize Gitkit client instance
--------------

```javascript
  var GitkitClient = require('gitkitclient');
  var gitkitClient = new GitkitClient({
    'clientId' : GOOGLE_OAUTH2_WEB_CLIENT_ID,
    'serviceAccountEmail' : SERVICE_ACCOUNT_EMAIL@developer.gserviceaccount.com,
    'serviceAccountPrivateKeyFile' : PRIVATE_KEY_IN_PEM_FORMAT.pem,
    'widgetUrl' : 'http://localhost:8000/gitkit',
    'cookieName' : 'gtoken'
  });
```

Verify Gitkit Token string
--------------

```javascript
  gitkitClient.verifyGitkitToken(tokenString, function (err, parsedToken) {
    console.log('login user is', parsedToken);
  });
```
  
Upload Multiple Accounts
--------------

```javascript
  var hashKey = new Buffer('key123');
  var hashOptions = {
    'hashAlgorithm': 'HMAC_SHA1',
    'hashKey': hashKey
  };
  function createNewUsers(hashKey) {
    var crypto = require('crypto');
    var user1 = {
      localId: '1234',
      email: '1234@example.com',
      salt: new Buffer('salt-1'),
      passwordHash: crypto.createHmac('SHA1', hashKey).update('1111' + 'salt-1').digest()
    };
    return [user1];
  }
  gitkitClient.uploadAccount(createNewUsers(hashKey), hashOptions, function (err, resp){
    if (err) {
      console.log('error: ', err);
    } else {
      console.log(resp);
    }
  });
```

Download Accounts
--------------

```javascript
  gitkitClient.downloadAccount(10, function(err, accounts){
    if (err) {
      console.log('error: ', err);
    } else {
      if (accounts != null) {
        console.log(accounts);
      } else {
        console.log('finished');
      }
    }
  });
```

Get Account Info
--------------

```javascript
  gitkitClient.getAccountByEmail("1234@example.com", function(err, resp) {
    console.log('getAccountByEmail: ', err, resp);
  });
  gitkitClient.getAccountById("1234", function(err, resp) {
    console.log('getAccountById: ', err, resp);
  });
```

Get the URL to verify user's email
--------------

```javascript
  gitkitClient.getEmailVerificationLink("1234@example.com", function(err, resp) {
    console.log('email verification link: ' + resp);
  });
```

Delete Account
--------------

```javascript
  gitkitClient.deleteAccount('1234', function(err, response){
    if (err) {
      console.log("error: ", err);
    } else {
      console.log(response);
    }
  });
```

---
_Source: https://npm.io/package/gitkitclient · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
