/Cordova-Google-Play-Token

Get a Google access token using Google's Android Java API and send it to your Javascript program. (i.e.: with OAUTH 2.0)

Primary LanguageJavaMIT LicenseMIT

cordova-google-play-token

Get an access token from Google using the Google Play Services API and Android API, and then use that access token in a Javascript program.

This is useful for accessing a user's Google or Google Play user data in Cordova apps or games.

Donations

Please help feed Tiny Tim!

Gratipay / Gittip: https://gratipay.com/agamemnus/

Paypal: agamemnus at flyingsoftgames dot com

Install & Setup

  1. Add the plugin to your build.
cordova plugin add https://github.com/agamemnus/googleplaytoken
  1. Run the getAccessToken function.

Usage / Function List

getAccessToken (alias: initialize): Initialize, potentially ask the user to authorize and log in, and get an access token. Note that the access token does expire every 60 minutes. A new token will be generated if getAccessToken is called more than once.

window.plugins.GooglePlayToken.getAccessToken ({
 success : function (access_token) {console.log (access_token)},
 error   : function (errormessage) {console.log (errormessage)}
})

setScope: Set the scope for the access token. The default scope is ``Scopes.PROFILE`` which is a constant value in ``com.google.android.gms.common.Scopes`` for "profile". ```` window.plugins.GooglePlayToken.setScope (scope_string) ````