Skip to content

Support providing azureADToken as credential #1467

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
1 task done
ronaldchwu opened this issue Apr 16, 2025 · 2 comments
Closed
1 task done

Support providing azureADToken as credential #1467

ronaldchwu opened this issue Apr 16, 2025 · 2 comments
Labels
azure Related to the Azure client / API

Comments

@ronaldchwu
Copy link

ronaldchwu commented Apr 16, 2025

Confirm this is a feature request for the Node library and not the underlying OpenAI API.

  • This is a feature request for the Node library

Describe the feature or improvement you're requesting

Currently, Azure OpenAI authentication only supports using azureADTokenProvider, but not azureADToken itself.

But some enterprise customers may manage AD token generation in a separate process.
This requires openai-node SDK to supports providing azureADToken directly, as in the Python SDK (link)

Such support will also benefit the uptake of recently released Codex CLI (which uses openai-node SDK under the hood). See ongoing issues/PR there (#11, #92)

Additional context

No response

@RobertCraigie RobertCraigie added the azure Related to the Azure client / API label Apr 17, 2025
@mikhail
Copy link

mikhail commented Apr 18, 2025

Hi @ronaldchwu,

Plain old tokens are a legacy idea since they expire. Python supported tokens at first and then introduced a concept of Providers to help with expiration; keeping direct token use as legacy support.

JS came afterwards and has learned from Python mistakes -- no need for raw tokens; providers can do the same and more.

Someone who wants to manage their own tokens ought to do that by creating their own provider. For example:

const myProvider = async () => {
  let currentToken = await GetCurrentToken();
  const expired = await HasExpired(currentToken);
  if (expired) {
    currentToken = await RegenerateToken(currentToken);
  }
  return currentToken
}

@ronaldchwu
Copy link
Author

Thanks @mikhail. Makes sense to me

@RobertCraigie RobertCraigie closed this as not planned Won't fix, can't repro, duplicate, stale Apr 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
azure Related to the Azure client / API
Projects
None yet
Development

No branches or pull requests

3 participants