Skip to content

OAuth 2.0 support - How to use Client ID / Client Secret with @bandwidth/numbers? #72

@ansarisufiyan777

Description

@ansarisufiyan777

We received an email regarding the OAuth 2.0 migration (from API Users to API Credentials), and we're trying to implement this before the deprecation deadline.

Image

The documentation here states:

"Newer versions of the Bandwidth SDKs handle the OAuth 2.0 Client Credentials flow for you. When initializing the SDK, provide your Client ID and Client Secret, and the SDK will manage token retrieval and refreshing automatically."

However, I cannot find any documentation or examples showing how to actually do this with @bandwidth/numbers. The current SDK (v1.10.0) only exposes userName and password for Basic Auth:

// Current - Basic Auth (working)
bandwidth.Client.globalOptions.userName = 'api_user';
bandwidth.Client.globalOptions.password = 'api_pass';

// Needed - OAuth 2.0 (how?)
bandwidth.Client.globalOptions.clientId = 'CLI-xxx';
bandwidth.Client.globalOptions.clientSecret = 'xxx';

Questions:

  1. Does this SDK support OAuth 2.0?
  2. If yes, how do we pass Client ID and Client Secret?
  3. If not, is there a timeline for support?

We have our OAuth credentials ready and the token endpoint works (https://api.bandwidth.com/api/v1/oauth2/token), but we don't know how to integrate it with the SDK.

Any guidance would be appreciated!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions