Access 'Chrome Web Store API' from a Cloud Function
I would like to access the 'Chrome Web Store API' from a Cloud Function.
https://developer.chrome.com/webstore/api_index#Licenses
Why?
We are making a chrome extension, and would like to check to see if a user has purchased the extension (i.e. license) in the web store. The license information is available from the Chrome Web Store API. We could make the request to the Web Store API directly from the extension, but then there is a (uglyish) pop-up for the user requesting permission to access the API on their behalf, which isn't ideal. We want to instead make a Cloud Function endpoint, that when sent the userID, responds with true or a false, depending on whether the user has a valid license. The Cloud Function should be able to get the license data for any user on this URL: (https://www.googleapis.com/chromewebstore/v1.1/licenses/$appID/$userID).
I have tried digging around for examples on how to do this. I think I need the equivalent of the Cloud Function version of the Google API Client Library, that handles authentication via oath2 or a service account.. but even then I don't see a way to set the URL for a GET request.
Much appreciate any pointers or suggestions.
add a comment |
I would like to access the 'Chrome Web Store API' from a Cloud Function.
https://developer.chrome.com/webstore/api_index#Licenses
Why?
We are making a chrome extension, and would like to check to see if a user has purchased the extension (i.e. license) in the web store. The license information is available from the Chrome Web Store API. We could make the request to the Web Store API directly from the extension, but then there is a (uglyish) pop-up for the user requesting permission to access the API on their behalf, which isn't ideal. We want to instead make a Cloud Function endpoint, that when sent the userID, responds with true or a false, depending on whether the user has a valid license. The Cloud Function should be able to get the license data for any user on this URL: (https://www.googleapis.com/chromewebstore/v1.1/licenses/$appID/$userID).
I have tried digging around for examples on how to do this. I think I need the equivalent of the Cloud Function version of the Google API Client Library, that handles authentication via oath2 or a service account.. but even then I don't see a way to set the URL for a GET request.
Much appreciate any pointers or suggestions.
You should not be needing to rely on user authorizing the request. Have you looked at developer.chrome.com/webstore/… ?
– Xan
Nov 14 at 13:46
Yes, I have tried to follow the instructions to the letter, including adding the relevant permissions, oath2 scopes and client id, to manifest.json. Our oath2 section has '../auth/chromewebstore.readonly', although one example in the link also has '../auth/plus.login', I could try adding that. The user still gets an uglyish popup to confirm their account, I guess this is a side effect of chrome.identity.getAuthToken(). Our other plan was to use chrome.identity.id, send that to a cloud function API, which then checks the Web Store API itself, on behalf of the project owner, not the user.
– user2927072
Nov 15 at 16:13
add a comment |
I would like to access the 'Chrome Web Store API' from a Cloud Function.
https://developer.chrome.com/webstore/api_index#Licenses
Why?
We are making a chrome extension, and would like to check to see if a user has purchased the extension (i.e. license) in the web store. The license information is available from the Chrome Web Store API. We could make the request to the Web Store API directly from the extension, but then there is a (uglyish) pop-up for the user requesting permission to access the API on their behalf, which isn't ideal. We want to instead make a Cloud Function endpoint, that when sent the userID, responds with true or a false, depending on whether the user has a valid license. The Cloud Function should be able to get the license data for any user on this URL: (https://www.googleapis.com/chromewebstore/v1.1/licenses/$appID/$userID).
I have tried digging around for examples on how to do this. I think I need the equivalent of the Cloud Function version of the Google API Client Library, that handles authentication via oath2 or a service account.. but even then I don't see a way to set the URL for a GET request.
Much appreciate any pointers or suggestions.
I would like to access the 'Chrome Web Store API' from a Cloud Function.
https://developer.chrome.com/webstore/api_index#Licenses
Why?
We are making a chrome extension, and would like to check to see if a user has purchased the extension (i.e. license) in the web store. The license information is available from the Chrome Web Store API. We could make the request to the Web Store API directly from the extension, but then there is a (uglyish) pop-up for the user requesting permission to access the API on their behalf, which isn't ideal. We want to instead make a Cloud Function endpoint, that when sent the userID, responds with true or a false, depending on whether the user has a valid license. The Cloud Function should be able to get the license data for any user on this URL: (https://www.googleapis.com/chromewebstore/v1.1/licenses/$appID/$userID).
I have tried digging around for examples on how to do this. I think I need the equivalent of the Cloud Function version of the Google API Client Library, that handles authentication via oath2 or a service account.. but even then I don't see a way to set the URL for a GET request.
Much appreciate any pointers or suggestions.
edited Nov 12 at 23:42
asked Nov 12 at 19:42
user2927072
61
61
You should not be needing to rely on user authorizing the request. Have you looked at developer.chrome.com/webstore/… ?
– Xan
Nov 14 at 13:46
Yes, I have tried to follow the instructions to the letter, including adding the relevant permissions, oath2 scopes and client id, to manifest.json. Our oath2 section has '../auth/chromewebstore.readonly', although one example in the link also has '../auth/plus.login', I could try adding that. The user still gets an uglyish popup to confirm their account, I guess this is a side effect of chrome.identity.getAuthToken(). Our other plan was to use chrome.identity.id, send that to a cloud function API, which then checks the Web Store API itself, on behalf of the project owner, not the user.
– user2927072
Nov 15 at 16:13
add a comment |
You should not be needing to rely on user authorizing the request. Have you looked at developer.chrome.com/webstore/… ?
– Xan
Nov 14 at 13:46
Yes, I have tried to follow the instructions to the letter, including adding the relevant permissions, oath2 scopes and client id, to manifest.json. Our oath2 section has '../auth/chromewebstore.readonly', although one example in the link also has '../auth/plus.login', I could try adding that. The user still gets an uglyish popup to confirm their account, I guess this is a side effect of chrome.identity.getAuthToken(). Our other plan was to use chrome.identity.id, send that to a cloud function API, which then checks the Web Store API itself, on behalf of the project owner, not the user.
– user2927072
Nov 15 at 16:13
You should not be needing to rely on user authorizing the request. Have you looked at developer.chrome.com/webstore/… ?
– Xan
Nov 14 at 13:46
You should not be needing to rely on user authorizing the request. Have you looked at developer.chrome.com/webstore/… ?
– Xan
Nov 14 at 13:46
Yes, I have tried to follow the instructions to the letter, including adding the relevant permissions, oath2 scopes and client id, to manifest.json. Our oath2 section has '../auth/chromewebstore.readonly', although one example in the link also has '../auth/plus.login', I could try adding that. The user still gets an uglyish popup to confirm their account, I guess this is a side effect of chrome.identity.getAuthToken(). Our other plan was to use chrome.identity.id, send that to a cloud function API, which then checks the Web Store API itself, on behalf of the project owner, not the user.
– user2927072
Nov 15 at 16:13
Yes, I have tried to follow the instructions to the letter, including adding the relevant permissions, oath2 scopes and client id, to manifest.json. Our oath2 section has '../auth/chromewebstore.readonly', although one example in the link also has '../auth/plus.login', I could try adding that. The user still gets an uglyish popup to confirm their account, I guess this is a side effect of chrome.identity.getAuthToken(). Our other plan was to use chrome.identity.id, send that to a cloud function API, which then checks the Web Store API itself, on behalf of the project owner, not the user.
– user2927072
Nov 15 at 16:13
add a comment |
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53269036%2faccess-chrome-web-store-api-from-a-cloud-function%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53269036%2faccess-chrome-web-store-api-from-a-cloud-function%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
You should not be needing to rely on user authorizing the request. Have you looked at developer.chrome.com/webstore/… ?
– Xan
Nov 14 at 13:46
Yes, I have tried to follow the instructions to the letter, including adding the relevant permissions, oath2 scopes and client id, to manifest.json. Our oath2 section has '../auth/chromewebstore.readonly', although one example in the link also has '../auth/plus.login', I could try adding that. The user still gets an uglyish popup to confirm their account, I guess this is a side effect of chrome.identity.getAuthToken(). Our other plan was to use chrome.identity.id, send that to a cloud function API, which then checks the Web Store API itself, on behalf of the project owner, not the user.
– user2927072
Nov 15 at 16:13