com.google.android.gms.common.api.GoogleApiClient.ServerAuthCodeCallbacks |
Provides callbacks to facilitate the server auth code retrieval and eliminates clients from manipulating background threads to do network communications with their own server.
Server auth code retrieving flow will look like below:
requestServerAuthCode(String, GoogleApiClient.ServerAuthCodeCallbacks)
should be invoked.
onCheckServerAuthorization(String, Set)
callback will allow
client to check their server whether it already has a refresh token so that server
auth code retrieval can be skipped.
onUploadServerAuthCode(String, String)
callback will allow client to send the auth code to
their own server.
Framework will invoke the callbacks on a background thread. It's NOT necessary to spawn background thread on your own for the network communication.
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
GoogleApiClient.ServerAuthCodeCallbacks.CheckResult |
The result holder for onCheckServerAuthorization(String, Set which contains below information:
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Called when client should check with their own web server whether it needs a (new) server
auth code to exchange for a (new) refresh token for the given account.
| |||||||||||
Called when server auth code has been fetched and client should upload it to their own
server.
|
Called when client should check with their own web server whether it needs a (new) server auth code to exchange for a (new) refresh token for the given account.
This callback happens on a background thread and it's OK to do network communication in this callback.
idToken | id token for the specific account. |
---|---|
scopeSet | an unmodifiable scope set which client side is planning to request access
with. If only your server does data access or your client side doesn't
user GoogleApiClient to do Google API access, then this scope set
will be empty. If your server / client have distinct functionality or
your server can figure out their required scopes without knowing what
your side is doing, then you can ignore this input as well. |
GoogleApiClient.ServerAuthCodeCallbacks.CheckResult
object. for details what
information we expect from the callback.
Called when server auth code has been fetched and client should upload it to their own server.
This callback happens on a background thread and it's OK to do network communication in this callback.
idToken | id token for the specific account. |
---|---|
serverAuthCode | the server auth code to be uploaded to the 3rd party web server. |
connect()
. If client wants to
ignore their server auth code exchange failure, they should always return true.