Skip to content

Commit 140992d

Browse files
committed
[Feature] SC-167944 Update Apps to use Global Proxy Service
1 parent 140992b commit 140992d

5 files changed

Lines changed: 138 additions & 113 deletions

File tree

manifest.json

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,24 @@
2424
}
2525
],
2626
"settings": {
27+
"use_deskpro_sass": {
28+
"title": "Use Deskpro SAAS",
29+
"type": "boolean",
30+
"isRequired": false,
31+
"isBackendOnly": false,
32+
"order": 5
33+
},
2734
"client_id": {
2835
"title": "Client ID",
2936
"type": "string",
30-
"isRequired": true,
37+
"isRequired": false,
3138
"isBackendOnly": false,
3239
"order": 10
3340
},
3441
"client_secret": {
3542
"title": "Client secret",
3643
"type": "string",
37-
"isRequired": true,
44+
"isRequired": false,
3845
"isBackendOnly": true,
3946
"order": 20
4047
},

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"bumpManifestVer": "node ./bin/bumpManifestVer.js"
1616
},
1717
"dependencies": {
18-
"@deskpro/app-sdk": "^5.1.1",
18+
"@deskpro/app-sdk": "^6.0.0",
1919
"@deskpro/deskpro-ui": "^8.2.0",
2020
"@fortawesome/free-solid-svg-icons": "^6.7.2",
2121
"@fortawesome/react-fontawesome": "^0.2.2",

pnpm-lock.yaml

Lines changed: 32 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/pages/AdminPage.tsx

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,16 @@ const AdminPage: FC = () => {
3030
useInitialisedDeskproAppClient(
3131
(client) => {
3232
client
33-
.oauth2()
34-
.getAdminGenericCallbackUrl(
35-
key,
36-
/code=(?<token>[0-9a-f]+)/,
37-
/state=(?<key>.+)/
38-
)
39-
.then(({ callbackUrl }) => setCallbackUrl(callbackUrl));
33+
.startOauth2Local(
34+
({ state, callbackUrl, codeChallenge }) => {
35+
setCallbackUrl(callbackUrl)
36+
return `https://idp.example.com/authorize?client_id=xxx&state=${state}&code_challenge=${codeChallenge}&redirect_uri=${callbackUrl}`
37+
},
38+
/\?code=(?<code>.+?)&/,
39+
async function convertResponseToToken(code: string) {
40+
return undefined as any; // This is never called, we are only interested in getting the URL, not actually authing.
41+
},
42+
);
4043
},
4144
[key]
4245
);

0 commit comments

Comments
 (0)