Skip to content

Authentication fails using Azure CLI login #752

Closed
@laudibert

Description

@laudibert

Describe the bug
Authentication fails using Azure. The "expires-on" property when using Azure authentication is in seconds but is expected in milliseconds.

Client Version
0.16.1

To Reproduce

  • az login
  • az get-credentials --resource-group xxx --name aks-name --subscription xxx
  • Any kubectl command to authenticate to the cluster
  • Execute:
const kc = new k8s.KubeConfig();
kc.loadFromDefault();
const appApi = kc.makeApiClient(k8s.AppsV1Api);
await appApi.readNamespacedDeployment('xxx', 'xxx');

Throws Error: Token is expired!

Expected behavior
Should not try to refresh token when it is not expired (just generated).

Additional context
The user authProvider.config has this set:

  environment: 'AzurePublicCloud',
  'expires-in': '4410',
  'expires-on': '1638979372', // in seconds

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