Skip to content

Commit 5ddaddf

Browse files
mdbraycastbot
andauthored
feat: Backstage plugin supports static token (raycast#20383)
* feat: Backstage plugin supports static token This addresses issue raycast#20382 and gives users of the Backstage Raycast plugin the ability to authenticate to Backstage via a static token. Signed-off-by: Mike Ball <mikedball@gmail.com> * Update CHANGELOG.md and optimise images --------- Signed-off-by: Mike Ball <mikedball@gmail.com> Co-authored-by: raycastbot <bot@raycast.com>
1 parent fe50e99 commit 5ddaddf

3 files changed

Lines changed: 19 additions & 2 deletions

File tree

extensions/backstage/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Backstage Changelog
22

3+
## [Support static token] - 2025-07-18
4+
5+
- address [issue 20382](https://github.com/raycast/extensions/issues/20382) and
6+
support Backstage static token authentication
7+
38
## [Initial Release] - 2024-08-08
49

510
- the initial release of Backstage extension, including Google Cloud IAP support.

extensions/backstage/package.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@
2626
"description": "Backstage URL",
2727
"required": true
2828
},
29+
{
30+
"type": "password",
31+
"name": "backstageStaticToken",
32+
"title": "Static Backstage API token",
33+
"description": "Static Backstage API token (for use in place of OAuth authentication)",
34+
"required": false
35+
},
2936
{
3037
"type": "textfield",
3138
"name": "iapOAuthClientId",

extensions/backstage/src/search-components.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ type Preferences = {
1818
iapOAuthClientId: string;
1919
raycastOAuthClientId: string;
2020
backstageUrl: string;
21+
backstageStaticToken: string;
2122
};
2223

2324
const preferences: Preferences = getPreferenceValues();
@@ -72,7 +73,11 @@ function SearchLinks({ svc }: { svc: Service }) {
7273
);
7374
}
7475

75-
async function getIdTokenIfNeeded() {
76+
async function getAuthTokenIfNeeded() {
77+
if (preferences.backstageStaticToken) {
78+
return preferences.backstageStaticToken;
79+
}
80+
7681
if (preferences.raycastOAuthClientId && preferences.iapOAuthClientId) {
7782
await authorize(["openid", "email"], preferences.raycastOAuthClientId, preferences.iapOAuthClientId);
7883
const tokens = await client.getTokens();
@@ -83,7 +88,7 @@ async function getIdTokenIfNeeded() {
8388
}
8489

8590
async function fetchBackstage() {
86-
const idToken = await getIdTokenIfNeeded();
91+
const idToken = await getAuthTokenIfNeeded();
8792

8893
const res = await fetch(`${preferences.backstageUrl}/api/catalog/entities?filter=kind=component`, {
8994
headers: idToken

0 commit comments

Comments
 (0)