chrome.identity.getAuthToken not working

前端 未结 4 1680
野性不改
野性不改 2021-02-01 23:33

I am working with Chrome Identity API, to provide users with a Google Authentication on my Chrome Extension.

I followed the official tutorial of Google : link Chrome Id

相关标签:
4条回答
  • 2021-02-02 00:10

    If the callback in chrome.identity.getAuthToken is not firing at all for you, make sure you are using "browser_action" in your manifest.json and not "page_action".

    0 讨论(0)
  • 2021-02-02 00:16

    For other user, who might face the problem that chrome.identify.getauthtoken is not firing or you log in and nothing happens.

    Check your manifest and reduce it to the bare minimum. For example the "oauth2": { "client.id": "alongstring" , "scopes": ["bla","openid", "bla"]}. Having openid in the array, the callback simply did not fire, no alert, no nothing.

    Having openid inside my scopes inside oauth2 blocked in someway the callback from being fired.

    0 讨论(0)
  • 2021-02-02 00:20

    The accepted answer is incorrect. You can upload it to the webstore, publish it, then install it from the webstore. After installing, find the installed extension app dir (~/Library/Application\ Support/Google/Chrome/Default/Extensions/<ext id> on a mac), and copy the key key from the installed manifest.json into your source code manifest.json. After adding the key field to your manifest.json, your app id will not change during local development.

    Source: https://developer.chrome.com/apps/app_identity#copy_key

    0 讨论(0)
  • 2021-02-02 00:26

    Problem Resolved !

    the app ID of my Chrome extension does not match with my app ID in Google Console Developpers To avoid this upload first your Extension then copy the ID from Chrome and set it in the Google Console Developpers ! you must update it in Google console everytime you change it in Google Chrome

    enter image description here

    0 讨论(0)
提交回复
热议问题