1
0
Fork 0
toolkit/packages/oidc-client
Sourav Chanduka 5afccaa9db removed whitespaces 2021-07-29 12:48:27 +05:30
..
__tests__ Resolved Comments 2021-07-29 12:17:22 +05:30
dist Resolved Comments 2021-07-29 12:17:22 +05:30
src removed whitespaces 2021-07-29 12:48:27 +05:30
LICENSE.md Inital draft of OIDC Client 2021-07-01 08:11:28 +05:30
README.md Update README.md 2021-07-28 15:56:10 +05:30
package-lock.json package.json updated 2021-07-27 08:47:54 +05:30
package.json package.json updated 2021-07-27 08:47:54 +05:30
tsconfig.json Inital draft of OIDC Client 2021-07-01 08:11:28 +05:30

README.md

@actions/oidc-client

Usage

You can use this package to interact with the GitHub OIDC provider and get a JWT ID token which would help to get access token from third party cloud providers.

Get the ID token

Method Name: getIDToken

Inputs

audience : optional

Outputs

A JWT ID Token

Example:

You can use this template to use the package.

main.ts

const core = require('@actions/core');
const id = require('@actions/oidc-client')


async function getIDTokenAction(): Promise<void> {
   
   let aud = ''
   const audience = core.getInput('audience', {required: false})
   if (audience !== undefined) 
      aud = `${audience}`
   const id_token = await id.getIDToken(aud)
   const val = `ID token is ${id_token}`
   core.setOutput('id_token', id_token);
      
}

getIDTokenAction()

actions.yml

name: 'GetIDToken'
description: 'Get ID token from Github OIDC provider'
inputs:
  audience:  
    description: 'Audience for which the ID token is intended for'
    required: false
outputs:
  id_token: 
    description: 'ID token obtained from OIDC provider'
runs:
  using: 'node12'
  main: 'dist/index.js'