GithubHelp home page GithubHelp logo

identity-toolkit-python-client's Introduction

This is the python client library for Google Identity Toolkit services.

Sample usage

Initialize Gitkit client instance

  p12_file = 'YOUR_SERVICE_ACCOUNT_PRIVATE_KEY_FILE.p12'
  f = file(p12_file, 'rb')
  key = f.read()
  f.close()
  gitkit_instance = gitkitclient.GitkitClient(
      client_id='YOUR_WEB_APPLICATION_CLIENT_ID_AT_GOOGLE_DEVELOPER_CONSOLE',
      service_account_email='[email protected]',
      service_account_key=key,
      widget_url='URL_ON_YOUR_SERVER_TO_HOST_GITKIT_WIDGET')

Verify Gitkit Token in HTTP request cookie

  user = gitkit_instance.VerifyGitkitToken(request.COOKIES['gtoken'])

Upload Multiple Accounts

  hashKey = 'hash-key'
  user1 = gitkitclient.GitkitUser()
  user1.email = '[email protected]'
  user1.user_id = '1234'
  user1.salt = 'salt-1'
  user1.passwordHash = calcHmac(hashKey, '1111', 'salt-1')

  user2 = gitkitclient.GitkitUser()
  user2.email = '[email protected]'
  user2.user_id = '5678'
  user2.salt = 'salt-2'
  user2.passwordHash = calcHmac(hashKey, '5555', 'salt-2')

  gitkit_instance.UploadUsers('HMAC_SHA1', hashKey, [user1, user2])

Download Accounts

  for account in gitkit_instance.GetAllUsers(2):
    pprint(vars(account))

Get Account Info

  pprint(vars(gitkit_instance.GetUserById('1234')))
  pprint(vars(gitkit_instance.GetUserByEmail('[email protected]')))

Delete Account

  gitkit_instance.DeleteUser('1234')

identity-toolkit-python-client's People

Contributors

cslink avatar liujin-google avatar naokigoogle avatar tjohns avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.