Skip to content

liujin-google/identity-toolkit-python-client

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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')

About

Google Identity Toolkit client library for Python

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%