Socket
Socket
Sign inDemoInstall

camunda-saas-oauth

Package Overview
Dependencies
32
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    camunda-saas-oauth

A library to exchange a set of Camunda 8 SaaS API credentials for a token


Version published
Maintainers
1
Install size
2.69 MB
Created

Changelog

Source

1.2.4

Fixes

Things that were broken and are now fixed.

  • Cached tokens were not correctly expired, leading to a 401 Unauthorized response to API calls after some time. The tokens are now correctly evicted from the cache. Thanks to @hanh-le-clv for reporting this. See this issue for more details.

Readme

Source

Camunda SaaS OAuth for Node.js

NPM

Community Extension

Lifecycle

License

A library to exchange a set of Camunda 8 SaaS API credentials for a token to make API calls to Camunda 8 SaaS. Uses camunda-8-credentials-from-env to get the credentials from the environment.

Caches the token to disk, and refreshes tokens before they expire.

Installation

Install as a dependency:

npm i camunda-saas-oauth

Usage

import * as auth from "camunda-saas-oauth"

async function main () {
    const useragent = 'myclient-nodejs/1.0.0'
    const operateToken = await auth.getOperateToken(useragent)
    const tasklistToken = await auth.getTasklistToken(useragent)
    const optimizeToken = await auth.getOptimizeToken(useragent)
    const zeebeToken = await auth.getZeebeToken(useragent)
    return {
        operateToken,
        tasklistToken,
        optimizeToken,
        zeebeToken
    }
}   

The call will throw if the client credentials are not found in the environment, or you request a token for a scope for which the credentials are not valid.

Configuration

Set the API client credentials in the environment, using the environment variables from the web console.

To configure a different cache directory, set the CAMUNDA_TOKEN_CACHE_DIR environment variable.

To turn off disk caching, set the environment variable CAMUNDA_TOKEN_CACHE=memory-only.

User Agent

Example of a custom user agent string: mycustom-client-nodejs/${pkg.version} ${CUSTOM_AGENT_STRING}

Advanced Usage

The methods that return tokens use an OAuthProvider to get the tokens.

The OAuthProvider class is a wrapper that hydrates a OAuthProviderImpl with credentials from the environment.

If you want to manually set the credentials (for example, to address multiple clusters in a single application), you can do so by creating an OAuthProviderImpl directly, like so:

import { OAuthProviderImpl } from 'camunda-saas-oauth'

const oauth = new OAuthProviderImpl({
        /** OAuth Endpoint URL */
        authServerUrl,
        /** OAuth Audience */
        audience, clientId, clientSecret,
        userAgentString
})

const operateToken = oauth.getToken('OPERATE')
const optimizeToken = oauth.getToken('OPTIMIZE')
const tasklistToken = oauth.getToken('TASKLIST')
const zeebeToken = oauth.getToken('ZEEBE')

FAQs

Last updated on 17 Nov 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc