Package | com.distriqt.extension.googleidentity |
Class | public final class GoogleIdentity |
Inheritance | GoogleIdentity flash.events.EventDispatcher |
This class represents the GoogleIdentity extension.
Allows you to sign in user's to your application via their Google account and access Google APIs on their behalf if required.
Property | Defined By | ||
---|---|---|---|
implementation : String [read-only]
The implementation currently in use. | GoogleIdentity | ||
isSupported : Boolean [static] [read-only]
Whether the current device supports the extensions functionality
| GoogleIdentity | ||
nativeVersion : String [read-only]
The native version string of the native extension. | GoogleIdentity | ||
service : GoogleIdentity [static] [read-only]
The singleton instance of the GoogleIdentity class. | GoogleIdentity | ||
version : String [read-only]
The version of this extension. | GoogleIdentity |
Method | Defined By | ||
---|---|---|---|
Constructor
You should not call this directly, but instead use the singleton access
| GoogleIdentity | ||
disconnect():Boolean
Disconnects the current user from the app and revokes previous authentication. | GoogleIdentity | ||
dispose():void
Disposes the extension and releases any allocated resources. | GoogleIdentity | ||
getToken(clientSecret:String):Boolean Deprecated: This has been deprecated as it is against best practice to use an access token on a device
Get a valid access token and a valid ID token,
refreshing them first if they have expired or are about to expire. | GoogleIdentity | ||
Get the current GoogleUser. | GoogleIdentity | ||
init(key:String):void Deprecated: You no longer need to use an application key [static]
Initialises the extension class for use with the provided key. | GoogleIdentity | ||
isSignedIn():Boolean
Returns true if there is a currently signed in user. | GoogleIdentity | ||
setup(options:GoogleIdentityOptions):void
Setup the Google Identity settings and initiate a connection to the
API services. | GoogleIdentity | ||
signIn():Boolean
Starts the user initiated sign-in process
| GoogleIdentity | ||
signInSilently():Boolean
If the user has previously accepted authentication etc then you can
expect a silent sign in at startup to succeed. | GoogleIdentity | ||
signOut():Boolean
Marks current user as being in the signed out state
| GoogleIdentity |
Event | Summary | Defined By | ||
---|---|---|---|---|
Dispatched when the user has been disconnected from this application. | GoogleIdentity | |||
An error occured error and errorCode will contain details of the error that occurred. | GoogleIdentity | |||
Dispatched when setup is complete. | GoogleIdentity | |||
Dispatched when sign in completes. | GoogleIdentity | |||
Dispatched when the user has been signed out. | GoogleIdentity | |||
Dispatched when the tokens failed to be retrieved or refreshed. | GoogleIdentity | |||
Dispatched when a call to getToken has completed successfully The access and id tokens in the user object will now be valid. | GoogleIdentity |
Constant | Defined By | ||
---|---|---|---|
EXT_CONTEXT_ID : String = com.distriqt.GoogleIdentity [static] | GoogleIdentity | ||
VERSION : String = 5.5.0 [static] | GoogleIdentity |
implementation | property |
implementation:String
[read-only]
The implementation currently in use. This should be one of the following depending on the platform in use and the functionality supported by this extension:
Android
iOS
default
unknown
public function get implementation():String
isSupported | property |
isSupported:Boolean
[read-only] Whether the current device supports the extensions functionality
public static function get isSupported():Boolean
nativeVersion | property |
nativeVersion:String
[read-only]
The native version string of the native extension.
public function get nativeVersion():String
service | property |
service:GoogleIdentity
[read-only] The singleton instance of the GoogleIdentity class.
public static function get service():GoogleIdentity
Error — If there was a problem creating or accessing the extension, or if the key is invalid
|
version | property |
version:String
[read-only]
The version of this extension.
This should be of the format, MAJOR.MINOR.BUILD
public function get version():String
GoogleIdentity | () | Constructor |
public function GoogleIdentity()
Constructor You should not call this directly, but instead use the singleton access
disconnect | () | method |
public function disconnect():Boolean
Disconnects the current user from the app and revokes previous authentication. If the operation succeeds, the OAuth 2.0 token is also removed from keychain.
Once disconnect is called you can expect signInSilently to fail.
ReturnsBoolean — true if started successfully and false otherwise
|
dispose | () | method |
public function dispose():void
Disposes the extension and releases any allocated resources. Once this function
has been called, a call to init
is neccesary again before any of the
extensions functionality will work.
getToken | () | method |
public function getToken(clientSecret:String):Boolean
Get a valid access token and a valid ID token, refreshing them first if they have expired or are about to expire.
Parameters
clientSecret:String |
Boolean — true if started successfully and false if the user is not signed in
|
getUser | () | method |
public function getUser():GoogleUser
Get the current GoogleUser
.
Will return null
if there is no user signed in.
GoogleUser — The current GoogleUser or null if not signed in
|
init | () | method |
public static function init(key:String):void
Initialises the extension class for use with the provided key.
Parameters
key:String |
Error — If there was a problem creating or accessing the extension, or if the key is invalid
|
isSignedIn | () | method |
public function isSignedIn():Boolean
Returns true
if there is a currently signed in user.
Boolean — true if a user is signed in and false if not.
|
setup | () | method |
public function setup(options:GoogleIdentityOptions):void
Setup the Google Identity settings and initiate a connection to the API services. Most importantly this call sets the client IDs for your application.
Parameters
options:GoogleIdentityOptions — GoogleIdentityOptions
|
GoogleIdentity.service.addEventListener( GoogleIdentityEvent.SETUP_COMPLETE, setupCompleteHandler ); var options:GoogleIdentityOptions = new GoogleIdentityOptions( "ANDROID_CLIENT_ID", "IOS_CLIENT_ID" ); GoogleIdentity.service.setup( options ); private function setupCompleteHandler( event:GoogleIdentityEvent ):void { // Setup is complete, can call sign in etc now GoogleIdentity.service.signInSilently(); }
signIn | () | method |
public function signIn():Boolean
Starts the user initiated sign-in process
ReturnsBoolean — true if started successfully and false otherwise
|
signInSilently | () | method |
public function signInSilently():Boolean
If the user has previously accepted authentication etc then you can expect a silent sign in at startup to succeed. You can do this early in your application to automatically sign in returning users.
It will dispatch an ERROR
event if sign in fails,
generally if the user hasn't signed in previously. You should call
signIn
at some other point in your application.
Boolean — true if started successfully and false otherwise
|
signOut | () | method |
public function signOut():Boolean
Marks current user as being in the signed out state
ReturnsBoolean — true if started successfully and false otherwise
|
googleidentity:disconnect | Event |
com.distriqt.extension.googleidentity.events.GoogleIdentityEvent
com.distriqt.extension.googleidentity.events.GoogleIdentityEvent.DISCONNECT
Dispatched when the user has been disconnected from this application.
googleidentity:error | Event |
com.distriqt.extension.googleidentity.events.GoogleIdentityEvent
com.distriqt.extension.googleidentity.events.GoogleIdentityEvent.ERROR
An error occured
error
and errorCode
will contain details of the
error that occurred.
- SIGN_IN_CANCELLED [12501]: The sign in was cancelled by the user. i.e. user cancelled some of the sign in resolutions, e.g. account picking or OAuth consent. - SIGN_IN_FAILED [12500]: The sign in attempt didn't succeed with the current account. Unlike SIGN_IN_REQUIRED. when seeing this error code, there is nothing user can do to recover from the sign in failure. - SIGN_IN_REQUIRED [4]: The client attempted to connect to the service but the user is not signed in. - INTERNAL_ERROR [8]: An internal error occurred. Retrying should resolve the problem. - INVALID_ACCOUNT [5]: The client attempted to connect to the service with an invalid account name specified. - NETWORK_ERROR [7]: A network error occurred. Retrying should resolve the problem.
googleidentity:setupcomplete | Event |
com.distriqt.extension.googleidentity.events.GoogleIdentityEvent
com.distriqt.extension.googleidentity.events.GoogleIdentityEvent.SETUP_COMPLETE
Dispatched when setup
is complete.
You should wait for this event before attempting any other functionality.
googleidentity:signin | Event |
com.distriqt.extension.googleidentity.events.GoogleIdentityEvent
com.distriqt.extension.googleidentity.events.GoogleIdentityEvent.SIGN_IN
Dispatched when sign in completes.
user
will contain a valid GoogleUser
object.
At this point the access and id tokens may not be valid. If you
are planning on using them you should now call getToken
and listen for the completion event.
googleidentity:signout | Event |
com.distriqt.extension.googleidentity.events.GoogleIdentityEvent
com.distriqt.extension.googleidentity.events.GoogleIdentityEvent.SIGN_OUT
Dispatched when the user has been signed out.
googleidentity:token:failed | Event |
com.distriqt.extension.googleidentity.events.GoogleIdentityEvent
com.distriqt.extension.googleidentity.events.GoogleIdentityEvent.TOKEN_FAILED
Dispatched when the tokens failed to be retrieved or refreshed.
googleidentity:token:updated | Event |
com.distriqt.extension.googleidentity.events.GoogleIdentityEvent
com.distriqt.extension.googleidentity.events.GoogleIdentityEvent.TOKEN_UPDATED
Dispatched when a call to getToken
has completed successfully
The access and id tokens in the user object will now be valid.
EXT_CONTEXT_ID | Constant |
public static const EXT_CONTEXT_ID:String = com.distriqt.GoogleIdentity
VERSION | Constant |
public static const VERSION:String = 5.5.0