identity-toolkit-ruby-client 是 Ruby 上的 Google Identity Toolkit 客户端的开发包。
示例:
require 'gitkit_client' # Create a server config file or download it from Google Developer Console # The config file contains Gitkit library config in json format # { # "clientId" : "oauth2-web-client-id.apps.googleusercontent.com", # "serviceAccountEmail" : "service-account-email@developer.gserviceaccount.com", # "serviceAccountPrivateKeyFile" : "path-to-service-account-private-key-file.p12", # "widgetUrl" : "full-url-of-gitkit-widget-on-your-site", # "cookieName" : "gtoken", # "serverKey" : "devconsole-server-key" # } # Create a Gitkit client gitkit_client = GitkitLib::GitkitClient.create_from_config_file 'gitkit-server-config.json' # Verify the Gitkit token in the incoming http request token = request.cookies["gtoken"] user = gitkit_client.verify_gitkit_token token # Upload passwords def calc_sha1(key, plain_text, salt) hmac = OpenSSL::HMAC.new key, 'sha1' hmac << plain_text hmac << salt hmac.digest end hash_key = 'hash-key' user1 = GitkitLib::GitkitUser.new user1.email = '1234@example.com' user1.user_id = '1234' user1.salt = 'salt-1' user1.password_hash = calc_sha1(hash_key, '1111', 'salt-1') user2 = GitkitLib::GitkitUser.new user2.email = '5678@example.com' user2.user_id = '5678' user2.salt = 'salt-2' user2.password_hash = calc_sha1(hash_key, '5555', 'salt-2') user2.name = '56 78' gitkit_client.upload_users 'HMAC_SHA1', hash_key, [user1, user2] # Get user by email user = gitkit_client.get_user_by_email('1234@example.com') # Get user by id user = gitkit_client.get_user_by_id('5678') # Delete a user gitkit_client.delete_user '5678' # Download all accounts gitkit_client.get_all_users(2) { |account| pp account}
Google Identity Toolkit client library for Java 是 Google Identity Toolkit 服务的 Java 客户端库。
identity-toolkit-go-client 是 Go 语言环境中的 Google identity Toolkit 客户端库。 示例: var client *gitkit.Clientfunc handleSignIn(w http.ResponseWriter, r *http.Request) { // If there is no valid session, check
identity-toolkit-python-client 是 Python 上的 Google Identity Toolkit 客户端库。
identity-toolkit-node-client 是 Node.js 上的 Google Identity Toolkit 客户端的开发包。可用于初始化 Gitkit 客户端;验证 Gitkit 令牌字符串;上传多个帐户;下载和删除账户;获得 URL 来确定用户的 email 。 代码示例: 初始化 Gitkit 客户端: var GitkitClient = require('gitki
Identity Toolkit PHP Client 是谷歌标识工具包服务的 PHP 客户端库。 示例代码: require_once __DIR__ . '/vendor/autoload.php';$gitkitClient = Gitkit_Client::createFromFile("gitkit-server-config.json");// ---- upload account
ruby api for china mobile's fetion 最简单的飞信客户端 示例代码: fetion = Fetion.new("mobile ID","password") fetion.login fetion.send_sms("mobile ID","any sms") fetion.send_sms_to_self("test-中文-ruby-fetion")