Skip to content

Commit

Permalink
Merge pull request #53 from Shopify/add-scope
Browse files Browse the repository at this point in the history
Add collaborator scope
  • Loading branch information
ishanray authored Apr 30, 2020
2 parents 72e855e + 4b770ba commit e54785d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Change Log

## v1.0.6
* [#53](https://github.com/Shopify/shopify-theme-inspector/pull/53) Add collaborator scope

## v1.0.5
* [#49](https://github.com/Shopify/shopify-theme-inspector/pull/49) Local development url detect
* [#52](https://github.com/Shopify/shopify-theme-inspector/pull/52) Allow search path profiling
Expand Down
8 changes: 6 additions & 2 deletions src/background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import {env} from './env';
import {isDev, Oauth2} from './utils';

const DEVTOOLS_SCOPE = 'https://api.shopify.com/auth/shop.storefront.devtools';
const COLLABORATORS_SCOPE =
'https://api.shopify.com/auth/partners.collaborator-relationships.readonly';

function getOauth2Client(origin: string) {
const identityDomain = isDev(origin)
Expand All @@ -13,7 +15,9 @@ function getOauth2Client(origin: string) {
const subjectId = isDev(origin)
? env.DEV_OAUTH2_SUBJECT_ID
: env.OAUTH2_SUBJECT_ID;
const clientAuthParams = [['scope', `openid profile ${DEVTOOLS_SCOPE}`]];
const clientAuthParams = [
['scope', `openid profile ${DEVTOOLS_SCOPE} ${COLLABORATORS_SCOPE}`],
];

return new Oauth2(clientId, subjectId, identityDomain, {clientAuthParams});
}
Expand Down Expand Up @@ -95,7 +99,7 @@ chrome.runtime.onMessage.addListener(({type, origin}, _, sendResponse) => {
}

const oauth2 = getOauth2Client(origin);
const params = [['scope', DEVTOOLS_SCOPE]];
const params = [['scope', `${DEVTOOLS_SCOPE} ${COLLABORATORS_SCOPE}`]];
const destination = `${origin}/admin`;

oauth2
Expand Down
2 changes: 1 addition & 1 deletion src/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Shopify Theme Inspector for Chrome",
"version": "1.0.5",
"version": "1.0.6",
"description": "Profile and debug Liquid template on your Shopify store",
"devtools_page": "devtools.html",
"permissions": ["storage", "identity", "activeTab"],
Expand Down

0 comments on commit e54785d

Please sign in to comment.