Tag: 在应用程序内购买

google-api-ruby-client当前用户没有足够的权限来执行请求的操作

我使用google-api-ruby-client google-api-ruby-client为我的后端服务器validationandroid inapppurchase代码(见下文): require ‘google/api_client’ require ‘google/api_client/client_secrets’ require ‘google/api_client/auth/installed_app’ API_VERSION = ‘v1.1’ service_account_email = ‘xxx@developer.gserviceaccount.com’ # Email of service account key_file = ‘xxx.p12’ # File containing your private key key_secret = ‘notasecret’ # Password to unlock private key scope_url = ‘https://www.googleapis.com/auth/androidpublisher’ client = Google::APIClient.new( :application_name => ‘Ruby Inapppurchases validate’, :application_version => ‘1.0.0’) key = Google::APIClient::KeyUtils.load_from_pkcs12(key_file, […]

在服务器端validation应用内购买Android / Google

我想在Android应用程序中使用应用内购买的购买令牌来validation我自己的服务器上的谷歌服务器。 使用以下代码,我可以validation令牌,但每次都必须使用我的OAuth凭据对自己进行身份validation: class GooglePlayVerification require ‘google/api_client’ # Refer: # https://code.google.com/p/google-api-ruby-client/issues/detail?id=72 # and # http://jonathanotto.com/blog/google_oauth2_api_quick_tutorial.html # and # http://milancermak.wordpress.com/2012/08/24/server-side-verification-of-google-play-subsc/ GOOGLE_KEY = ‘xxx.apps.googleusercontent.com’ GOOGLE_SECRET = ‘xxxx’ APP_NAME = ‘xx.xx.xx’ SCOPE = “https://www.googleapis.com/auth/androidpublisher” def self.token @@token ||= begin require ‘oauth2’ raise “Missing client_id variable” if GOOGLE_KEY.to_s.empty? raise “Missing client_secret variable” if GOOGLE_SECRET.to_s.empty? raise “Missing scope variable” if SCOPE.to_s.empty? […]