Skip to content
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

[Azure] Refresh AAD token on retry #5

Merged
merged 1 commit into from
Aug 17, 2024
Merged

Conversation

deyaaeldeen
Copy link
Owner

  • I understand that this repository is auto-generated and my pull request may not be merged

Changes being requested

The AAD token may need to be refreshed between retries so this fix makes sure to always call the token provider irrespective of whether the authorization header is being set.

Additional context & links

@@ -485,7 +485,7 @@ export class AzureOpenAI extends OpenAI {
}

protected override async prepareOptions(opts: Core.FinalRequestOptions<unknown>): Promise<void> {
if (opts.headers?.['Authorization'] || opts.headers?.['api-key']) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this will overwrite an Authorization header passed by the user?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't support the scenario of passing a single AAD token in the authorization header manually. The client constructor requires the user to provide either an API key or an AAD token provider.

@deyaaeldeen deyaaeldeen merged commit 89efb87 into master Aug 17, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants