Identity Toolkit PHP Client PHP 客户端库

程序名称:Identity Toolkit PHP Client

授权协议: Apache

操作系统: 跨平台

开发语言: PHP

Identity Toolkit PHP Client 介绍

Identity Toolkit PHP Client 是谷歌标识工具包服务的 PHP 客户端库。

示例代码

require_once __DIR__ . '/vendor/autoload.PHP';
$gitkitClient = Gitkit_Client::createFromFile("gitkit-server-config.json");
// ---- upload account -----
$hashKey = "\x01\x02\x03";
$gitkitClient->uploadUsers('HMAC_SHA1', $hashKey, createNewUsers($hashKey));
// --- verify gitkit token ----
$user = 
$gitkitClient->validatetoken("eyJhb...");
// ---- get account info by user identifier ----
$user = $gitkitClient->getUserById("1234");
// ---- get a url to send to user's email address to verify ownership -----
$verificationLink = $gitkitClient->getEmailVerificationLink("[email protected]");
// ---- download account ----$iterator = $gitkitClient->getAllUsers(3);
while ($iterator->valid()) {  $user = $iterator->current();  
// $user is a Gitkit_Account object  $iterator->next();}
// ---- delete account ----
$gitkitClient->deleteUser('1234');
function createNewUsers($hashKey) {  
$allUsers = array();  
$gitkitUser = new Gitkit_Account();  
$gitkitUser->setEmail("[email protected]");  
$gitkitUser->setUserId("1234");  
$salt = "\05\06\07";  
$password = '1111';  
$gitkitUser->setSalt($salt);  
$gitkitUser->setPasswordHash(hash_hmac('sha1', $password . $salt, $hashKey, true));
array_push($allUsers, $gitkitUser);  
$gitkitUser = new Gitkit_Account();  
$gitkitUser->setEmail('[email protected]');  
$gitkitUser->setUserId('5678');  
$salt = "\15\16\17";  
$password = '5555';  
$gitkitUser->setSalt($salt);  
$gitkitUser->setPasswordHash(hash_hmac('sha1', $password . $salt, $hashKey, true));  
array_push($allUsers, $gitkitUser);  return $allUsers;}

Identity Toolkit PHP Client 官网

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

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐