Okta SDK For Client Credentials

Is there a Node Okta SDK method for retrieving an access token via the client credentials grant type? I’ve looked a most of the options available and haven’t found one yet.

Example of the client credentials flow I’m referring to

Hi @sseekamp, please look over the following documentation and let me know if this is helpful for your use case.

Hi @sseekamp, please look over the following documentation and please let me know if this is helpful for your use case.

1 Like

Hi @louie that documentation seems related to using an express API and the JWT verifier library to validate tokens being sent in are valid JWTs.

I’m looking for a way to retrieve a JWT from an Okta service application via client credentials with an Okta SDK library.

Basically replicate this API call with an Okta SDK library

const axios = require('axios')

const getAccessToken = async () => {
    try {
        const request = await axios({
            method: 'POST',
            url: '<mytenanturl>/oauth2/default/v1/token',
            headers: {
                'content-type': 'application/x-www-form-urlencoded',
                accept: 'application/json',
                authorization: `Basic <Base64 client_id:client_secret>`,
                'cache-control': 'no-cache',
            },
            data: 'grant_type=client_credentials&scope=customScope',
        })
        console.log(request.data.access_token)
    } catch (error) {
        console.log(error)
    }
}

getAccessToken()