Skip to content
This repository was archived by the owner on Sep 14, 2021. It is now read-only.

google/identity-toolkit-python-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

83 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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

Build Status

Installation

pip install identity-toolkit-python-client

If you run into issues installing, you may be missing some dependencies such as libffi or python-dev. On Debian, you can install these with:

sudo apt-get install python-dev libffi-dev

(replace python-dev with python3-dev if using Python 3)

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='YOUR_SERVICE_ACCOUNT_EMAIL@developer.gserviceaccount.com',
      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 = '1234@example.com'
  user1.user_id = '1234'
  user1.salt = 'salt-1'
  user1.passwordHash = calcHmac(hashKey, '1111', 'salt-1')

  user2 = gitkitclient.GitkitUser()
  user2.email = '5678@example.com'
  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('5678@example.com')))

Delete Account

  gitkit_instance.DeleteUser('1234')

About

Google Identity Toolkit client library for Python

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors 8

Languages