mirror of https://github.com/actions/toolkit
default aud parameter
parent
1c03cd3284
commit
1f8d7b5a64
|
@ -278,7 +278,9 @@ const core = require('@actions/core');
|
||||||
async function getIDTokenAction(): Promise<void> {
|
async function getIDTokenAction(): Promise<void> {
|
||||||
|
|
||||||
const audience = core.getInput('audience', {required: false})
|
const audience = core.getInput('audience', {required: false})
|
||||||
const id_token = await core.getIDToken(audience)
|
|
||||||
|
const id_token1 = await core.getIDToken() // ID Token with default audience
|
||||||
|
const id_token2 = await core.getIDToken(audience) // ID token with custom audience
|
||||||
|
|
||||||
// this id_token can be used to get access token from third party cloud providers
|
// this id_token can be used to get access token from third party cloud providers
|
||||||
}
|
}
|
||||||
|
@ -295,7 +297,9 @@ inputs:
|
||||||
description: 'Audience for which the ID token is intended for'
|
description: 'Audience for which the ID token is intended for'
|
||||||
required: false
|
required: false
|
||||||
outputs:
|
outputs:
|
||||||
id_token:
|
id_token1:
|
||||||
|
description: 'ID token obtained from OIDC provider'
|
||||||
|
id_token2:
|
||||||
description: 'ID token obtained from OIDC provider'
|
description: 'ID token obtained from OIDC provider'
|
||||||
runs:
|
runs:
|
||||||
using: 'node12'
|
using: 'node12'
|
||||||
|
|
|
@ -351,6 +351,6 @@ export function getState(name: string): string {
|
||||||
return process.env[`STATE_${name}`] || ''
|
return process.env[`STATE_${name}`] || ''
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getIDToken(aud = undefined): Promise<string> {
|
export async function getIDToken(aud: string | undefined = undefined): Promise<string> {
|
||||||
return await OidcClient.getIDToken(aud)
|
return await OidcClient.getIDToken(aud)
|
||||||
}
|
}
|
Loading…
Reference in New Issue