Struggling with chrome.identity

425 views
Skip to first unread message

Tyler Goss

unread,
Sep 17, 2014, 11:21:13 AM9/17/14
to chromium-...@chromium.org
Looking to integrate one time payments into my chrome extension and am following these instructions: https://developer.chrome.com/webstore/one_time_payments


I believe I have done these correctly:
  1. If you haven't already, enable the Chrome Identity API, see User Authentication for more information.
  2. If you haven't already, enable the Chrome Web Store API in the Google APIs Console.
  3. In the manifest.json file:
    1. Add https://www.googleapis.com/ to the permissions section.
    2. Add https://www.googleapis.com/auth/chromewebstore.readonly to thescopes subsection of the oauth2 section.

I have enabled the Identity API, and created a client_id, and enable the Chrome Web Store API 

I have updated my manifest.json file and it looks like this:

  "permissions": [
     "storage", "identity", "https://www.googleapis.com/"
  ],
  
  "oauth2": {
    "client_id": "THE_IDENTITY_API_CLIENT_ID",
    "scopes": [
    ]
  },

The next step is:

Get the current users authentication token using chrome.identity.getAuthToken()

I get an error message: can't call getAuthoToken of undefined.  So chrome.identity is returning undefined.  Not sure why, help?

Thanks!

Ty

Jamie Walch

unread,
Sep 17, 2014, 6:39:14 PM9/17/14
to Tyler Goss, Chromium-extensions
To use chrome.identity, your app must be a "v2" app, which means that the manifest should contain something like:

  "app": {
    "background": {
      "page": "background.html"
     }
  },

By contrast, "v1" apps contain something like:

  "app": {
    "launch": {
      "local_path": "main.html"
    }
  },

(note the "launch" section instead of a "background" section). chrome.identity will be undefined in a "v1" app.

Migrating from v1 to v2 is a significant amount of work; it's not enough just to change the manifest. You can find a lot of examples at https://github.com/GoogleChrome/chrome-app-samples, including some that use the identity API.


--
You received this message because you are subscribed to the Google Groups "Chromium-extensions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extens...@chromium.org.
To post to this group, send email to chromium-...@chromium.org.
Visit this group at http://groups.google.com/a/chromium.org/group/chromium-extensions/.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-extensions/bc1ada6a-2ade-40eb-a6ee-81c74ba0c816%40chromium.org.
For more options, visit https://groups.google.com/a/chromium.org/d/optout.

Reply all
Reply to author
Forward
0 new messages