问题描述:

I am building a chrome extension, and my extension needs user authentication like Pocket chrome extension did. You know Pocket extension authentication way is sync user login state with pocket web site automatically. I know some basic knowledge about Chrome Identity API and OAuth2,does Pocket extension used those technical?

Any comment is welcome, I will be very glad if someone can tell me more detail about this.Thanks.:)

网友答案:

Finally,I found the solution after I dig into Pocket chrome extension source code.

As we know we can find Chrome extension installation folder on local machine, what's more, thanks to Pocket team didn't uglify their source code, I can refer to the manifest.json file and here is the content_scripts attribution:

"content_scripts": [
{
  "js": [
    "js/jquery-2.1.1.min.js",
    "js/shared.js",
    "js/login-inject.js"
  ],
  "matches": [
    "*://getpocket.com/extension_login_success"
  ]
},
{
  "js": [
    "js/jquery-2.1.1.min.js",
    "js/shared.js",
    "js/logout-inject.js"
  ],
  "matches": [
    "*://getpocket.com/login?e=4"
  ]
}
......
}

So I think it is clear that why Pocket chrome extension authentication can sync login state with Pocket official website automatically.

相关阅读:
Top