When I attempted to execute using the endpoint and API key in Azure OpenAI, according to the error message, it appears that the access token I am using has expired.

su 0 Reputation points
2023-06-17T03:45:53.2733333+00:00

When I attempted to execute using the endpoint and API key in Azure OpenAI, according to the error message, it appears that the access token I am using has expired.
How can I execute operations at the OpenAI endpoint without running out of access tokens?

{
  "error": {
    "code": "ExpiredAuthenticationToken",
    "message": "The access token expiry UTC time '6/17/2023 1:57:11 AM' is earlier than current UTC time '6/17/2023 3:35:34 AM'."
  }
}
Azure OpenAI Service
Azure OpenAI Service
An Azure service that provides access to OpenAI’s GPT-3 models with enterprise capabilities.
{count} votes

1 answer

Sort by: Most helpful
  1. AshokPeddakotla-MSFT 36,006 Reputation points Moderator
    2023-06-19T09:51:30.4166667+00:00

    su Greetings & Welcome to Microsoft Q&A forum!

    When I attempted to execute using the endpoint and API key in Azure OpenAI, according to the error message, it appears that the access token I am using has expired.The error message "ExpiredAuthenticationToken" indicating that your access token has expired when attempting to execute operations at the OpenAI endpoint, you will need to obtain a new access token to continue using the service.

    You can find the Keys in the Azure portal. The Endpoint and Keys can be found in the Resource Management section. Copy your endpoint and access key as you'll need both for authenticating your API calls. You can use either KEY1 or KEY2. Always having two keys allows you to securely rotate and regenerate keys without causing a service disruption.

    User's image

    It's also important to note that access tokens have a limited lifespan and will expire after a certain period of time. To avoid running out of access tokens, you can implement a token refresh mechanism in your application or script that automatically obtains a new access token when the current token is about to expire. This can help ensure that your application or script can continue to access the OpenAI endpoint without interruption.

    How can I execute operations at the OpenAI endpoint without running out of access tokens?

    To avoid running out of access tokens when using the OpenAI endpoint in Azure, you can use Azure Key Vault to securely store and manage your access tokens.

    For more details, please refer Customer-managed keys with Azure Key Vault

    Hope this helps. Do let us know if you have any further queries.

    If this answers your query, do click Accept Answer and Yes for was this answer helpful. And, if you have any further query do let us know.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.