gitkitclient

WebJar for gitkitclient

License

License

Categories

Categories

CLI User Interface
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

gitkitclient
Last Version

Last Version

0.0.7
Release Date

Release Date

Type

Type

jar
Description

Description

gitkitclient
WebJar for gitkitclient
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/google/identity-toolkit-node-client

Download gitkitclient

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/gitkitclient/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>gitkitclient</artifactId>
    <version>0.0.7</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/gitkitclient/
implementation 'org.webjars.npm:gitkitclient:0.0.7'
// https://jarcasting.com/artifacts/org.webjars.npm/gitkitclient/
implementation ("org.webjars.npm:gitkitclient:0.0.7")
'org.webjars.npm:gitkitclient:jar:0.0.7'
<dependency org="org.webjars.npm" name="gitkitclient" rev="0.0.7">
  <artifact name="gitkitclient" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='gitkitclient', version='0.0.7')
)
libraryDependencies += "org.webjars.npm" % "gitkitclient" % "0.0.7"
[org.webjars.npm/gitkitclient "0.0.7"]

Dependencies

compile (3)

Group / Artifact Type Version
org.webjars.npm : async jar [1.5.2,2)
org.webjars.npm : googleapis jar [5.2.1,6)
org.webjars.npm : request jar [2.72.0,3)

Project Modules

There are no modules declared in this project.

Google Identity Toolkit client library for Node.js

Sample usage

Initialize Gitkit client instance

  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

  gitkitClient.verifyGitkitToken(tokenString, function (err, parsedToken) {
    console.log('login user is', parsedToken);
  });

Upload Multiple Accounts

  var hashKey = new Buffer('key123');
  var hashOptions = {
    'hashAlgorithm': 'HMAC_SHA1',
    'hashKey': hashKey
  };
  function createNewUsers(hashKey) {
    var crypto = require('crypto');
    var user1 = {
      localId: '1234',
      email: '[email protected]',
      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

  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

  gitkitClient.getAccountByEmail("[email protected]", 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

  gitkitClient.getEmailVerificationLink("[email protected]", function(err, resp) {
    console.log('email verification link: ' + resp);
  });

Delete Account

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

Google

Google ❤️ Open Source

Versions

Version
0.0.7