Skip to content

Commit

Permalink
fix: add audience to complete JWT verification
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Goller <[email protected]>
  • Loading branch information
goller committed May 2, 2024
1 parent f1407b1 commit 016e3db
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/utils/fly.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,21 @@ import {Agent, fetch} from 'undici'
export async function getFlyToken(): Promise<string> {
try {
const res = await fetch('http://localhost/v1/tokens/oidc', {
signal: AbortSignal.timeout(1000),
signal: AbortSignal.timeout(5000),
method: 'POST',
body: JSON.stringify({aud: 'https://depot.dev'}),
headers: {'Content-Type': 'application/json'},
dispatcher: new Agent({
connect: {
socketPath: '/.fly/api',
},
}),
})

if (!res.ok) {
throw new Error(`unable to get oidc token: ${res.statusText}`)
}

const data = await res.text()
return data
} catch (err) {
Expand Down

0 comments on commit 016e3db

Please sign in to comment.