class Gpsoauth::Client
Constants
- AUTH_URL
- B64_KEY_7_3_29
The key is distirbuted with
Google
Play Services. This one is from version 7.3.29.- USER_AGENT
Public Class Methods
new(android_id, service = nil, device_country = nil, operator_country = nil, lang = nil, sdk_version = nil)
click to toggle source
# File lib/gpsoauth/client.rb, line 12 def initialize(android_id, service = nil, device_country = nil, operator_country = nil, lang = nil, sdk_version = nil) @android_id = android_id @service = service || "ac2dm" @device_country = device_country || "us" @operator_country = operator_country || "us" @lang = lang || "en" @sdk_version = sdk_version || 17 end
Public Instance Methods
master_login(email, password)
click to toggle source
# File lib/gpsoauth/client.rb, line 24 def master_login(email, password) android_key = Google::key_from_b64(B64_KEY_7_3_29) data = { accountType: "HOSTED_OR_GOOGLE", Email: email, has_permission: 1, add_account: 1, EncryptedPasswd: Google::signature(email, password, android_key), service: @service, source: "android", androidId: @android_id, device_country: @device_country, operatorCountry: @operator_country, lang: @lang, sdk_version: @sdk_version } auth_request(data) end
oauth(email, master_token, service, app, client_signature)
click to toggle source
# File lib/gpsoauth/client.rb, line 45 def oauth(email, master_token, service, app, client_signature) data = { accountType: "HOSTED_OR_GOOGLE", Email: email, has_permission: 1, EncryptedPasswd: master_token, source: "android", androidId: @android_id, device_country: @device_country, operatorCountry: @operator_country, lang: @lang, sdk_version: @sdk_version, service: service, app: app, client_sig: client_signature } auth_request(data) end
Private Instance Methods
auth_request(data)
click to toggle source
# File lib/gpsoauth/client.rb, line 67 def auth_request(data) options = { body: data, headers: { "User-Agent" => USER_AGENT, "Accept-Encoding" => "" } } response = HTTParty.post(AUTH_URL, options) parse_auth_response(response) end
parse_auth_response(response)
click to toggle source
# File lib/gpsoauth/client.rb, line 80 def parse_auth_response(response) Hash[response.each_line.map { |l| l.chomp.split("=", 2) }] end