Skip to content

Adopt TokenCredential from @azure/core-auth instead of custom TokenProvider interface #28

Description

@daviburg

Context

The Node SDK uses a custom TokenProvider interface that returns Promise<string> (raw token value). The .NET SDK accepts TokenCredential from Azure.Core, which is the standard interface shared by every @azure/* client library.

Parity gap

// Current Node SDK
export interface TokenProvider {
    getAccessTokenAsync(scopes: string[]): Promise<string>;
}

// .NET SDK equivalent (Azure.Core)
public abstract TokenCredential // getToken(TokenRequestContext, CancellationToken): AccessToken

The practical impact:

  • Callers using @azure/identity credentials (DefaultAzureCredential, WorkloadIdentityCredential, etc.) must wrap them in ManagedIdentityTokenProvider — an unnecessary adapter
  • The SDK cannot be composed with @azure/core-auth credential chains (ChainedTokenCredential, custom TokenCredential implementations)
  • No access to token expiry (expiresOnTimestamp) so proactive refresh isn't possible

Proposed change

Replace TokenProvider with TokenCredential from @azure/core-auth:

import { TokenCredential } from "@azure/core-auth";

// ConnectorClientBase constructor becomes:
constructor(connectionRuntimeUrl: string, credential: TokenCredential, options?: ConnectorClientOptions)

@azure/core-auth is already a transitive dependency (via @azure/identity). Promoting it to a direct peer dependency and using TokenCredential directly aligns the Node SDK with every other @azure/* package.

This is a breaking API change — best paired with the @azure/core-rest-pipeline adoption (where BearerTokenCredentialPolicy consumes TokenCredential directly).

Azure SDK guideline

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions