diff --git a/packages/oidc-client/src/internal/config-variables.ts b/packages/oidc-client/src/internal/config-variables.ts index 511aec07..39d18585 100644 --- a/packages/oidc-client/src/internal/config-variables.ts +++ b/packages/oidc-client/src/internal/config-variables.ts @@ -14,18 +14,8 @@ export function getIDTokenUrl(): string { return runtimeUrl } -export function getWorkFlowRunId(): string { - const workFlowRunId = process.env['GITHUB_RUN_ID'] - if (!workFlowRunId) { - throw new Error('Unable to get GITHUB_RUN_ID env variable') - } - return workFlowRunId -} - export function getIDTokenFromEnv(): string { const tokenId = process.env['OIDC_TOKEN_ID'] //Need to check the exact env var name - if(!tokenId) { - throw new Error('Unable to get OIDC_TOKEN_ID env variable') - } + return tokenId } diff --git a/packages/oidc-client/src/internal/utils.ts b/packages/oidc-client/src/internal/utils.ts index 8ad38c50..f721c7a5 100644 --- a/packages/oidc-client/src/internal/utils.ts +++ b/packages/oidc-client/src/internal/utils.ts @@ -23,8 +23,7 @@ import { ]) } - export function getApiVersion(): string { - return '1.0' + return '2.0' } diff --git a/packages/oidc-client/src/main.ts b/packages/oidc-client/src/main.ts index d4f6b3d9..5aa16d4f 100644 --- a/packages/oidc-client/src/main.ts +++ b/packages/oidc-client/src/main.ts @@ -41,8 +41,11 @@ export async function getIDToken(audience: string): Promise { } core.debug(`Httpclient created ${httpclient} `) // debug is only output if you set the secret `ACTIONS_RUNNER_DEBUG` to true + var additionalHeaders = {[httpclient.Headers.ContentType]: httpclient.MediaTypes.ApplicationJson} - const response = await httpclient.post(id_tokne_url, audience) + var data : String = new String('id_token_aud:') + data = data.concat(audience) + const response = await httpclient.post(id_tokne_url, data, additionalHeaders) if (!isSuccessStatusCode(response.message.statusCode)){ @@ -53,7 +56,7 @@ export async function getIDToken(audience: string): Promise { const body: string = await response.readBody() const val = JSON.parse(body) - id_token = val['id_token'] + id_token = val['value'] if (id_token == undefined) { throw new Error(`Not able to fetch the ID token`) @@ -63,7 +66,7 @@ export async function getIDToken(audience: string): Promise { core.exportVariable('OIDC_TOKEN_ID', id_token) return id_token - + } catch (error) { core.setFailed(error.message) return error.message