Welcome Getting started API Reference Samples
Welcome Getting started API Reference Samples

chrome.instanceID

  • Description

    Use chrome.instanceID to access the Instance ID service.

  • Permissions
    gcm

Summary

  • Methods
    chrome.instanceID.deleteID(callback: function)
    chrome.instanceID.deleteToken(deleteTokenParams: object, callback: function)
    chrome.instanceID.getCreationTime(callback: function)
    chrome.instanceID.getID(callback: function)
    chrome.instanceID.getToken(getTokenParams: object, callback: function)
  • Events

Methods

deleteID

chrome.instanceID.deleteID(callback: function)

Resets the app instance identifier and revokes all tokens associated with it.

Parameters

  • callback
    function

    Function called when the deletion completes. The instance identifier was revoked successfully if runtime.lastError is not set.

    The callback parameter should be a function that looks like this:

    () => {...}

deleteToken

chrome.instanceID.deleteToken(deleteTokenParams: object, callback: function)

Revokes a granted token.

Parameters

  • deleteTokenParams
    object

    Parameters for deleteToken.

    • authorizedEntity
      string

      The authorized entity that is used to obtain the token.

    • scope
      string

      The scope that is used to obtain the token.

  • callback
    function

    Function called when the token deletion completes. The token was revoked successfully if runtime.lastError is not set.

    The callback parameter should be a function that looks like this:

    () => {...}

getCreationTime

chrome.instanceID.getCreationTime(callback: function)

Retrieves the time when the InstanceID has been generated. The creation time will be returned by the callback.

Parameters

  • callback
    function

    Function called when the retrieval completes. It should check runtime.lastError for error when creationTime is zero.

    The callback parameter should be a function that looks like this:

    (creationTime: number) => {...}
    • creationTime
      number

      The time when the Instance ID has been generated, represented in milliseconds since the epoch.

getID

chrome.instanceID.getID(callback: function)

Retrieves an identifier for the app instance. The instance ID will be returned by the callback. The same ID will be returned as long as the application identity has not been revoked or expired.

Parameters

  • callback
    function

    Function called when the retrieval completes. It should check runtime.lastError for error when instanceID is empty.

    The callback parameter should be a function that looks like this:

    (instanceID: string) => {...}
    • instanceID
      string

      An Instance ID assigned to the app instance.

getToken

chrome.instanceID.getToken(getTokenParams: object, callback: function)

Return a token that allows the authorized entity to access the service defined by scope.

Parameters

  • getTokenParams
    object

    Parameters for getToken.

    • authorizedEntity
      string

      Identifies the entity that is authorized to access resources associated with this Instance ID. It can be a project ID from Google developer console.

    • options
      object optional

      Deprecated. options are deprecated and will be ignored.

      Allows including a small number of string key/value pairs that will be associated with the token and may be used in processing the request.

    • scope
      string

      Identifies authorized actions that the authorized entity can take. E.g. for sending GCM messages, GCM scope should be used.

  • callback
    function

    Function called when the retrieval completes. It should check runtime.lastError for error when token is empty.

    The callback parameter should be a function that looks like this:

    (token: string) => {...}
    • token
      string

      A token assigned by the requested service.

Events

onTokenRefresh

chrome.instanceID.onTokenRefresh.addListener(listener: function)

Fired when all the granted tokens need to be refreshed.

Event

  • listener
    function

    The listener parameter should be a function that looks like this:

    () => {...}
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.