Trying to find out oauth for my chrome extension using api id.
I uploaded the code at
https://github.com/Sandeep3005/learn-oauth-extension
Problem:
When the background file starts, it opens a new tab using the Gmail login page. But even I provide the correct credentials, the login page reappears again and again, and I need to get to exit Chrome.
The solution presented in the solution - mentions that this happens when the application identifier in chrome differs from the application name in https://console.developers.google.com .
But I checked and double-checked it. Both app-ID values ββare accurate.
Can anyone help me on this.
manifest.json
{
"manifest_version": 2,
"name": "outh-test-2",
"short_name": "outh-test-2",
"description": "Description for outh-test-2",
"version": "1.0",
"background": { "scripts": [ "background.js" ], "persistent": true },
"content_scripts": [
{
"run_at": "document_end",
"matches": [
"https://www.dominos.co.in/",
"https://en.wikipedia.org/*"
],
"js": [ "content.js" ]
}
],
"permissions": [
"identity"
],
"oauth2": {
"client_id": "574710815026-blt94u58ie7jqqanuc73b49mdaqrp9j4.apps.googleusercontent.com",
"scopes": [
"http://www.googleapis.com/auth/drive"
]
},
"key":"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmRBFelCyG27kHcy38C/bZXggBPDV3JyKnsunJDfHotUG9QQI6Z+KzoeEdCKK/GvQe7AGTNkkr3FUATGmR1b5MbjzTx90qzg6xsrXSU7mqBgJwYPny+PW46pGRwMSz4FEcLO1vUKD9kIhpSzi+0RJv1IwDx6/SNeQzOxXR5B7dWXTKtbiD9f9Rd5yj9Qfy1Q76iIc8P6afpO1DgT960+yZV4+12tCoC+GZILvK3GBwC0vhkeVsIMWaNkIIzC/0PcbLis2HrfZz6iHcetcv4aY6MAIfQWBxaFbDiXXIhXSvi9zO00w/mc9hLxls4fcivXZdEowgEu0UV4+EJuzL35s2wIDAQAB"
}
background.js
console.log('Welcome to background Page');
console.log('chrome Identity = ', chrome.identity);
chrome.identity.getAuthToken({ interactive: true }, function (token) {
if (chrome.runtime.lastError) {
callback(chrome.runtime.lastError);
return;
}
access_token = token;
});
The steps I followed
1. Created a basic chrome extension with no client ID and key
2. Extend the ziped extension file for
https://chrome.google.com/webstore/developer/dashboard
3.Copied public key and item id.
4. Create a new project in the Google Developer Console.
5.
a) OAuth
) Chrome
c) , webstore
d) .
6) manifest.json, .
background.js chrome boom - , google ...
,