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

inability to login using my az cli: The ID token is not yet valid #20434

Closed
Catherinechinwe opened this issue Nov 19, 2021 · 22 comments
Closed
Assignees
Labels
Account az login/account customer-reported Issues that are reported by GitHub users external to the Azure organization.
Milestone

Comments

@Catherinechinwe
Copy link

This is autogenerated. Please review and update as needed.

Describe the bug

Command Name
az login

Errors:

The command failed with an unexpected error. Here is the traceback:
0. The ID token is not yet valid. Current epoch = 1637312587.  The id_token was: {
  "aud": "04b07795-8ddb-461a-bbee-02f9e1bf7b46",
  "iss": "https://login.microsoftonline.com/f8cdef31-a31e-4b4a-93e4-5f571e91255a/v2.0",
  "iat": 1637312767,
  "nbf": 1637312767,
  "exp": 1637316667,
  "aio": "AYQAe/8TAAAAXxxvn6DrU9RWHJigp8yG/nLnqpsAiSI1PT4JYVKr9KaOtWlanv4hQnrTnnCWT1GfeHzNd55etkPhBtBS2maOKp/ugYH40Xbxg0FnIxKCKHOY0zk1IKpxER8WvjlWXW9k8SnAbpgMyHpb+jTbtPT4iPLZsDXNKhhKAPecULsFT5Q=",
  "idp": "https://sts.windows.net/9188040d-6c67-4c5b-b112-36a304b66dad/",
  "nonce": "112ebefa08862dabfc035f5f5c32f91447d26a365aca586d962973f5c1d7fc18",
  "preferred_username": "[email protected]",
  "prov_data": [
    {
      "at": true,
      "prov": "github.com",
      "altsecid": "68647459"
    }
  ],
  "rh": "0.AWAAMe_N-B6jSkuT5F9XHpElWpV3sATbjRpGu-4C-eG_e0YBABs.",
  "sub": "z3pT9ehkPuxq0bHMHq_5D255yNVtiIcRfpzNooOlDnQ",
  "tid": "f8cdef31-a31e-4b4a-93e4-5f571e91255a",
  "uti": "4_h7M1KCPkuCWRrkEj3yAA",
  "ver": "2.0"
}
Traceback (most recent call last):
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 231, in invoke
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 657, in execute
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 720, in _run_jobs_serially
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 691, in _run_job
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 328, in __call__
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/command_operation.py", line 121, in handler
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/profile/custom.py", line 145, in login
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/_profile.py", line 155, in login
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/auth/identity.py", line 121, in login_with_auth_code
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\msal/application.py", line 1488, in acquire_token_interactive
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\msal/oauth2cli/oidc.py", line 280, in obtain_token_by_browser
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\msal/oauth2cli/oauth2.py", line 660, in obtain_token_by_browser
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\msal/application.py", line 135, in obtain_token_by_auth_code_flow
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\msal/oauth2cli/oidc.py", line 204, in obtain_token_by_auth_code_flow
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\msal/oauth2cli/oauth2.py", line 548, in obtain_token_by_auth_code_flow
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\msal/oauth2cli/oauth2.py", line 714, in _obtain_token_by_authorization_code
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\msal/oauth2cli/oidc.py", line 115, in _obtain_token
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\msal/oauth2cli/oauth2.py", line 771, in _obtain_token
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\msal/application.py", line 523, in <lambda>
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\msal/token_cache.py", line 307, in add
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\msal/token_cache.py", line 113, in add
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\msal/token_cache.py", line 152, in __add
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\msal/oauth2cli/oidc.py", line 76, in decode_id_token
RuntimeError: 0. The ID token is not yet valid. Current epoch = 1637312587.  The id_token was: {
  "aud": "04b07795-8ddb-461a-bbee-02f9e1bf7b46",
  "iss": "https://login.microsoftonline.com/f8cdef31-a31e-4b4a-93e4-5f571e91255a/v2.0",
  "iat": 1637312767,
  "nbf": 1637312767,
  "exp": 1637316667,
  "aio": "AYQAe/8TAAAAXxxvn6DrU9RWHJigp8yG/nLnqpsAiSI1PT4JYVKr9KaOtWlanv4hQnrTnnCWT1GfeHzNd55etkPhBtBS2maOKp/ugYH40Xbxg0FnIxKCKHOY0zk1IKpxER8WvjlWXW9k8SnAbpgMyHpb+jTbtPT4iPLZsDXNKhhKAPecULsFT5Q=",
  "idp": "https://sts.windows.net/9188040d-6c67-4c5b-b112-36a304b66dad/",
  "nonce": "112ebefa08862dabfc035f5f5c32f91447d26a365aca586d962973f5c1d7fc18",
  "preferred_username": "[email protected]",
  "prov_data": [
    {
      "at": true,
      "prov": "github.com",
      "altsecid": "68647459"
    }
  ],
  "rh": "0.AWAAMe_N-B6jSkuT5F9XHpElWpV3sATbjRpGu-4C-eG_e0YBABs.",
  "sub": "z3pT9ehkPuxq0bHMHq_5D255yNVtiIcRfpzNooOlDnQ",
  "tid": "f8cdef31-a31e-4b4a-93e4-5f571e91255a",
  "uti": "4_h7M1KCPkuCWRrkEj3yAA",
  "ver": "2.0"
}

To Reproduce:

Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.

  • Put any pre-requisite steps here...
  • az login

Expected Behavior

Environment Summary

Windows-10-10.0.19041-SP0
Python 3.8.9
Installer: MSI

azure-cli 2.30.0

Additional Context

@ghost ghost added needs-triage This is a new issue that needs to be triaged to the appropriate team. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that customer-reported Issues that are reported by GitHub users external to the Azure organization. labels Nov 19, 2021
@yonzhan yonzhan added the Account az login/account label Nov 19, 2021
@ghost ghost removed the needs-triage This is a new issue that needs to be triaged to the appropriate team. label Nov 19, 2021
@yonzhan yonzhan removed the question The issue doesn't require a change to the product in order to be resolved. Most issues start as that label Nov 19, 2021
@yonzhan yonzhan added this to the Backlog milestone Nov 19, 2021
@yonzhan
Copy link
Collaborator

yonzhan commented Nov 19, 2021

@jiasli for awareness

@jiasli jiasli changed the title inability to login using my az cli inability to login using my az cli: The ID token is not yet valid Nov 19, 2021
@jiasli
Copy link
Member

jiasli commented Nov 19, 2021

Duplicate of #20158

Please check the solution at #20158 (comment)

@jiasli jiasli marked this as a duplicate of #20388 Nov 19, 2021
@Catherinechinwe
Copy link
Author

@jiasli how do i make the id token valid

@yonzhan
Copy link
Collaborator

yonzhan commented Nov 19, 2021

As the error suggested: Current epoch = 1635894218. This is 2021-11-2 23:03:38 UTC (converted using https://www.epochconverter.com/).

This issue was raised at 2021-11-2 21:57 UTC. Make sure the local time of you machine is correctly set.

@jiasli jiasli marked this as a duplicate of #20158 Nov 22, 2021
@jiasli jiasli closed this as completed Nov 22, 2021
@shelly-goel
Copy link

I'm facing the same issue and local time is correctly set (epoch and my local time are same). Please explain what needs to be done to make az login work.

@jiasli
Copy link
Member

jiasli commented Nov 22, 2021

@shelly-goel, could you share the detailed error message with the decoded ID token?

@shelly-goel
Copy link

shelly-goel commented Nov 22, 2021

$ az login
WARNING: The default web browser has been opened at https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize. Please continue the login in the web browser. If no web browser is available or if the web browser fails to open, use device code flow with az login --use-device-code.
ERROR: The command failed with an unexpected error. Here is the traceback:
ERROR: 0. The ID token is not yet valid. Current epoch = 1637592999. The id_token was: {
"aud": "04b07795-8ddb-461a-bbee-02f9e1bf7b46",
"iss": "https://login.microsoftonline.com/f8cdef31-a31e-4b4a-93e4-5f571e91255a/v2.0",
"iat": 1637593141,
"nbf": 1637593141,
"exp": 1637597041,
"aio": "AYQAe/8TAAAAzmhiXAw8hhmgP+yiCf4TP7tY88bVOadqnHbyr7vdeYjzO8ODUk0ZDEcmFZhYHl+CnkFh2N2wywyOrlkPHrndccvrAuoeSUefusl0Xd61F+ly7QXBqK8I2MgA88/npzd224LCn9HZIIWUK8wKcJeJ3oadPBaRSKUMMMp2Ja5OfuE=",
"idp": "https://sts.windows.net/9188040d-6c67-4c5b-b112-36a304b66dad/",
"nonce": "ed564c912166a28b4d46ba584a1dc9d3cf8fdcbad4bc9e0e6f1b81ded9a34fff",
"preferred_username": "[email protected]",
"rh": "0.AXcAMe_N-B6jSkuT5F9XHpElWpV3sATbjRpGu-4C-eG_e0YBABY.",
"sub": "Gy7mAEmbo-j-1xe9Uxb0YrXmEZjY21Gi3w9Dk87r6ik",
"tid": "f8cdef31-a31e-4b4a-93e4-5f571e91255a",
"uti": "o_JaRNQpL0Od_zCdSafYAA",
"ver": "2.0"
}
Traceback (most recent call last):
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 231, in invoke
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 657, in execute
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 720, in _run_jobs_serially
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 691, in _run_job
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 328, in call
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/command_operation.py", line 121, in handler
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/profile/custom.py", line 145, in login
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/_profile.py", line 155, in login
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/auth/identity.py", line 121, in login_with_auth_code
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\msal/application.py", line 1488, in acquire_token_interactive
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\msal/oauth2cli/oidc.py", line 280, in obtain_token_by_browser
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\msal/oauth2cli/oauth2.py", line 660, in obtain_token_by_browser
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\msal/application.py", line 135, in obtain_token_by_auth_code_flow
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\msal/oauth2cli/oidc.py", line 204, in obtain_token_by_auth_code_flow
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\msal/oauth2cli/oauth2.py", line 548, in obtain_token_by_auth_code_flow
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\msal/oauth2cli/oauth2.py", line 714, in _obtain_token_by_authorization_code
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\msal/oauth2cli/oidc.py", line 115, in _obtain_token
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\msal/oauth2cli/oauth2.py", line 771, in _obtain_token
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\msal/application.py", line 523, in
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\msal/token_cache.py", line 307, in add
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\msal/token_cache.py", line 113, in add
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\msal/token_cache.py", line 152, in __add
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\msal/oauth2cli/oidc.py", line 76, in decode_id_token
RuntimeError: 0. The ID token is not yet valid. Current epoch = 1637592999. The id_token was: {
"aud": "04b07795-8ddb-461a-bbee-02f9e1bf7b46",
"iss": "https://login.microsoftonline.com/f8cdef31-a31e-4b4a-93e4-5f571e91255a/v2.0",
"iat": 1637593141,
"nbf": 1637593141,
"exp": 1637597041,
"aio": "AYQAe/8TAAAAzmhiXAw8hhmgP+yiCf4TP7tY88bVOadqnHbyr7vdeYjzO8ODUk0ZDEcmFZhYHl+CnkFh2N2wywyOrlkPHrndccvrAuoeSUefusl0Xd61F+ly7QXBqK8I2MgA88/npzd224LCn9HZIIWUK8wKcJeJ3oadPBaRSKUMMMp2Ja5OfuE=",
"idp": "https://sts.windows.net/9188040d-6c67-4c5b-b112-36a304b66dad/",
"nonce": "ed564c912166a28b4d46ba584a1dc9d3cf8fdcbad4bc9e0e6f1b81ded9a34fff",
"preferred_username": "",
"rh": "0.AXcAMe_N-B6jSkuT5F9XHpElWpV3sATbjRpGu-4C-eG_e0YBABY.",
"sub": "Gy7mAEmbo-j-1xe9Uxb0YrXmEZjY21Gi3w9Dk87r6ik",
"tid": "f8cdef31-a31e-4b4a-93e4-5f571e91255a",
"uti": "o_JaRNQpL0Od_zCdSafYAA",
"ver": "2.0"
}
To open an issue, please run: 'az feedback'

@jiasli
Copy link
Member

jiasli commented Nov 22, 2021

Per https://www.epochconverter.com/, the current epoch time is 1637595637, but your machine shows 1637592999, which apparently incorrect.

@shelly-goel
Copy link

the output I shared was from last execution sometime back. Current execution is below and close to current epoch time
$ az login
WARNING: The default web browser has been opened at https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize. Please continue the login in the web browser. If no web browser is available or if the web browser fails to open, use device code flow with az login --use-device-code.
ERROR: The command failed with an unexpected error. Here is the traceback:
ERROR: 0. The ID token is not yet valid. Current epoch = 1637595382. The id_token was: {
"aud": "04b07795-8ddb-461a-bbee-02f9e1bf7b46",
"iss": "https://login.microsoftonline.com/f8cdef31-a31e-4b4a-93e4-5f571e91255a/v2.0",
"iat": 1637595524,
"nbf": 1637595524,
"exp": 1637599424,
"aio": "AYQAe/8TAAAA2HGSOHGDSMGX9IHblFpAgclDs63JZemXvXmoUHmMKB70chTiJioT7ZUOvAp8fWcrG1at2LgfRVq5YDc9cdyG9WfJs5v7AvoPFqLdEGlhmzxfOSq8us6nDGHu2FR2QZpxdIFlDmD4Ey679E5GOGXTmRVeHbxn1HrMnFpF88w3f54=",
"idp": "https://sts.windows.net/9188040d-6c67-4c5b-b112-36a304b66dad/",
"nonce": "5f1de301592efd3e1085b99ecbc5fc59bb58f2b28576df46db06851a520051ea",
"preferred_username": "[email protected]",
"rh": "0.AXcAMe_N-B6jSkuT5F9XHpElWpV3sATbjRpGu-4C-eG_e0YBABY.",
"sub": "Gy7mAEmbo-j-1xe9Uxb0YrXmEZjY21Gi3w9Dk87r6ik",
"tid": "f8cdef31-a31e-4b4a-93e4-5f571e91255a",
"uti": "q7FTA1LaV0y-7VhZ31XvAA",
"ver": "2.0"
}
Traceback (most recent call last):
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 231, in invoke
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 657, in execute
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 720, in _run_jobs_serially
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 691, in _run_job
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 328, in call
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/command_operation.py", line 121, in handler
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/profile/custom.py", line 145, in login
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/_profile.py", line 155, in login
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/auth/identity.py", line 121, in login_with_auth_code
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\msal/application.py", line 1488, in acquire_token_interactive
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\msal/oauth2cli/oidc.py", line 280, in obtain_token_by_browser
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\msal/oauth2cli/oauth2.py", line 660, in obtain_token_by_browser
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\msal/application.py", line 135, in obtain_token_by_auth_code_flow
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\msal/oauth2cli/oidc.py", line 204, in obtain_token_by_auth_code_flow
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\msal/oauth2cli/oauth2.py", line 548, in obtain_token_by_auth_code_flow
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\msal/oauth2cli/oauth2.py", line 714, in _obtain_token_by_authorization_code
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\msal/oauth2cli/oidc.py", line 115, in _obtain_token
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\msal/oauth2cli/oauth2.py", line 771, in _obtain_token
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\msal/application.py", line 523, in
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\msal/token_cache.py", line 307, in add
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\msal/token_cache.py", line 113, in add
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\msal/token_cache.py", line 152, in __add
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\msal/oauth2cli/oidc.py", line 76, in decode_id_token
RuntimeError: 0. The ID token is not yet valid. Current epoch = 1637595382. The id_token was: {
"aud": "04b07795-8ddb-461a-bbee-02f9e1bf7b46",
"iss": "https://login.microsoftonline.com/f8cdef31-a31e-4b4a-93e4-5f571e91255a/v2.0",
"iat": 1637595524,
"nbf": 1637595524,
"exp": 1637599424,
"aio": "AYQAe/8TAAAA2HGSOHGDSMGX9IHblFpAgclDs63JZemXvXmoUHmMKB70chTiJioT7ZUOvAp8fWcrG1at2LgfRVq5YDc9cdyG9WfJs5v7AvoPFqLdEGlhmzxfOSq8us6nDGHu2FR2QZpxdIFlDmD4Ey679E5GOGXTmRVeHbxn1HrMnFpF88w3f54=",
"idp": "https://sts.windows.net/9188040d-6c67-4c5b-b112-36a304b66dad/",
"nonce": "5f1de301592efd3e1085b99ecbc5fc59bb58f2b28576df46db06851a520051ea",
"preferred_username": "[email protected]",
"rh": "0.AXcAMe_N-B6jSkuT5F9XHpElWpV3sATbjRpGu-4C-eG_e0YBABY.",
"sub": "Gy7mAEmbo-j-1xe9Uxb0YrXmEZjY21Gi3w9Dk87r6ik",
"tid": "f8cdef31-a31e-4b4a-93e4-5f571e91255a",
"uti": "q7FTA1LaV0y-7VhZ31XvAA",
"ver": "2.0"
}
To open an issue, please run: 'az feedback'

@jiasli
Copy link
Member

jiasli commented Nov 22, 2021

The time you posted this is 1637595900, but it shows 1637595382, it is a 518 seconds off, almost 10 minutes. Please make sure your computer is synchronized to the correct time. "below and close" is not enough.

@shelly-goel
Copy link

Computer is configured with Internet time, not sure what you mean "synchronized to correct time". I executed again and command shows: Current epoch = 1637596031 whereas https://www.epochconverter.com shows: Current epoch = 1637596050

@jiasli
Copy link
Member

jiasli commented Nov 22, 2021

https://www.epochconverter.com/ shows 1637596616 for me. 🤔

@jiasli
Copy link
Member

jiasli commented Nov 22, 2021

I see what is going on. https://www.epochconverter.com/ is actually showing the local computer time! Could you try to adjust your computer's time according to https://time.is/ ?

@shelly-goel
Copy link

It works now, thanks!

@jiasli
Copy link
Member

jiasli commented Dec 23, 2021

Detailed summary is provided in #20388 (comment).

@rayluo
Copy link
Member

rayluo commented Dec 23, 2021

Detailed summary is provided in #20388 (comment).

Why is #20388 put in backlog, by the way? All these issues should be closed as an FAQ, and/or converted into a Q&A in Discussion channel.

@jiasli
Copy link
Member

jiasli commented Dec 23, 2021

Why is #20388 put in backlog, by the way? All these issues should be closed as an FAQ, and/or converted into a Q&A in Discussion channel.

Azure CLI Tools team doesn't use Discussion for issue triage and management yet. Also, the issue linking feature of Discussion is very limited. That's why we want to keep using Issues.

@denzii
Copy link

denzii commented Mar 28, 2022

I'm hitting this problem even though https://time.is/ is showing my time as "exact" with the message "The difference from Time.is was -0.001 seconds (±0.067 seconds). " Please advise what steps should be taken.

$ az login
A web browser has been opened at https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize. Please continue the login in the web browser. If no web browser is available or if the web browser fails to open, use device code flow with az login --use-device-code.
The command failed with an unexpected error. Here is the traceback:
0. The ID token is not yet valid. Current epoch = 1648456949. The id_token was: {
"aud": "04b07795-8ddb-461a-bbee-02f9e1bf7b46",
"iss": "https://login.microsoftonline.com/f8cdef31-a31e-4b4a-93e4-5f571e91255a/v2.0",
"iat": 1648467449,
"nbf": 1648467449,
"exp": 1648471349,
"aio": "AWQAm/8TAAAACWYzLt9DZDfNr5i0TuIZFgkIZawp7fsYJetN6Mgvidvv07wK3MHXIwY8382f3xbMf8ED4jodBySlFzb9nisHxi7y7k2ZLfc/gCJX8FK7mJ8A45O5E2b6kB2mWpyQy6xq",
"idp": "https://sts.windows.net/9188040d-6c67-4c5b-b112-36a304b66dad/",
"nonce": "ed8fa4a9c570050129cfbbd92e700d1b5344f019d5b4d25d756f4f4f8d3f1eb6",
"preferred_username": "[email protected]",
"rh": "0.AU4AMe_N-B6jSkuT5F9XHpElWpV3sATbjRpGu-4C-eG_e0YBAEs.",
"sub": "wOdMwc60gdPInre-itU64pzwt8coRpIJYKBC8QWL9Ms",
"tid": "f8cdef31-a31e-4b4a-93e4-5f571e91255a",
"uti": "l2HXBIqC3UOdbWpZiQWtAA",
"ver": "2.0"
}
Traceback (most recent call last):
File "/opt/az/lib/python3.8/site-packages/knack/cli.py", line 231, in invoke
cmd_result = self.invocation.execute(args)
File "/opt/az/lib/python3.8/site-packages/azure/cli/core/commands/init.py", line 658, in execute
raise ex
File "/opt/az/lib/python3.8/site-packages/azure/cli/core/commands/init.py", line 721, in _run_jobs_serially
results.append(self._run_job(expanded_arg, cmd_copy))
File "/opt/az/lib/python3.8/site-packages/azure/cli/core/commands/init.py", line 692, in _run_job
result = cmd_copy(params)
File "/opt/az/lib/python3.8/site-packages/azure/cli/core/commands/init.py", line 328, in call
return self.handler(*args, **kwargs)
File "/opt/az/lib/python3.8/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
return op(**command_args)
File "/opt/az/lib/python3.8/site-packages/azure/cli/command_modules/profile/custom.py", line 139, in login
subscriptions = profile.login(
File "/opt/az/lib/python3.8/site-packages/azure/cli/core/_profile.py", line 155, in login
user_identity = identity.login_with_auth_code(scopes=scopes, **kwargs)
File "/opt/az/lib/python3.8/site-packages/azure/cli/core/auth/identity.py", line 171, in login_with_auth_code
result = self._msal_app.acquire_token_interactive(
File "/opt/az/lib/python3.8/site-packages/msal/application.py", line 1546, in acquire_token_interactive
response = _clean_up(self.client.obtain_token_by_browser(
File "/opt/az/lib/python3.8/site-packages/msal/oauth2cli/oidc.py", line 280, in obtain_token_by_browser
return super(Client, self).obtain_token_by_browser(
File "/opt/az/lib/python3.8/site-packages/msal/oauth2cli/oauth2.py", line 640, in obtain_token_by_browser
return self._obtain_token_by_browser(
File "/opt/az/lib/python3.8/site-packages/msal/oauth2cli/oauth2.py", line 678, in _obtain_token_by_browser
return self.obtain_token_by_auth_code_flow(
File "/opt/az/lib/python3.8/site-packages/msal/application.py", line 135, in obtain_token_by_auth_code_flow
return super(_ClientWithCcsRoutingInfo, self).obtain_token_by_auth_code_flow(
File "/opt/az/lib/python3.8/site-packages/msal/oauth2cli/oidc.py", line 204, in obtain_token_by_auth_code_flow
result = super(Client, self).obtain_token_by_auth_code_flow(
File "/opt/az/lib/python3.8/site-packages/msal/oauth2cli/oauth2.py", line 548, in obtain_token_by_auth_code_flow
return self._obtain_token_by_authorization_code(
File "/opt/az/lib/python3.8/site-packages/msal/oauth2cli/oauth2.py", line 732, in _obtain_token_by_authorization_code
return self._obtain_token("authorization_code", data=data, **kwargs)
File "/opt/az/lib/python3.8/site-packages/msal/oauth2cli/oidc.py", line 115, in _obtain_token
ret = super(Client, self)._obtain_token(grant_type, *args, **kwargs)
File "/opt/az/lib/python3.8/site-packages/msal/oauth2cli/oauth2.py", line 789, in _obtain_token
(on_obtaining_tokens or self.on_obtaining_tokens)({
File "/opt/az/lib/python3.8/site-packages/msal/application.py", line 581, in
on_obtaining_tokens=lambda event: self.token_cache.add(dict(
File "/opt/az/lib/python3.8/site-packages/msal/token_cache.py", line 307, in add
super(SerializableTokenCache, self).add(event, **kwargs)
File "/opt/az/lib/python3.8/site-packages/msal/token_cache.py", line 113, in add
return self.__add(event, now=now)
File "/opt/az/lib/python3.8/site-packages/msal/token_cache.py", line 152, in __add
decode_id_token(id_token, client_id=event["client_id"])
File "/opt/az/lib/python3.8/site-packages/msal/oauth2cli/oidc.py", line 76, in decode_id_token
raise RuntimeError("%s Current epoch = %s. The id_token was: %s" % (
RuntimeError: 0. The ID token is not yet valid. Current epoch = 1648456949. The id_token was: {
"aud": "04b07795-8ddb-461a-bbee-02f9e1bf7b46",
"iss": "https://login.microsoftonline.com/f8cdef31-a31e-4b4a-93e4-5f571e91255a/v2.0",
"iat": 1648467449,
"nbf": 1648467449,
"exp": 1648471349,
"aio": "AWQAm/8TAAAACWYzLt9DZDfNr5i0TuIZFgkIZawp7fsYJetN6Mgvidvv07wK3MHXIwY8382f3xbMf8ED4jodBySlFzb9nisHxi7y7k2ZLfc/gCJX8FK7mJ8A45O5E2b6kB2mWpyQy6xq",
"idp": "https://sts.windows.net/9188040d-6c67-4c5b-b112-36a304b66dad/",
"nonce": "ed8fa4a9c570050129cfbbd92e700d1b5344f019d5b4d25d756f4f4f8d3f1eb6",
"preferred_username": "[email protected]",
"rh": "0.AU4AMe_N-B6jSkuT5F9XHpElWpV3sATbjRpGu-4C-eG_e0YBAEs.",
"sub": "wOdMwc60gdPInre-itU64pzwt8coRpIJYKBC8QWL9Ms",
"tid": "f8cdef31-a31e-4b4a-93e4-5f571e91255a",
"uti": "l2HXBIqC3UOdbWpZiQWtAA",
"ver": "2.0"
}
To open an issue, please run: 'az feedback'

@rayluo
Copy link
Member

rayluo commented Apr 1, 2022

@denzii,

Did you run your "az login" on your local desktop, or on a remote VM? In the latter case, https://time.is won't be able to detect your remote VM's time.

The error message contained:

RuntimeError: 0. The ID token is not yet valid. Current epoch = 1648456949. The id_token was: {
...
"iat": 1648467449,
"nbf": 1648467449,

Based on that error message, the machine running "az login" was 3 hours behind the AAD server's time.

Can you still reproduce this issue? If so, you can use online tools such as https://www.epochconverter.com/ to convert those timestamps back to GMT or your local time. And see if that would give you/us more hint.

@dylanwa
Copy link

dylanwa commented May 12, 2022

For people who use WSL2 and Azure CLI, there is an active issue "WSL2 date incorrect after waking from sleep" for now
microsoft/WSL#8204

You can verify if time matches with this command:

Get-Date; wsl date

And this workaround works for me -
It set up a Windows scheduled task to update Ubuntu datetime when machine wake up from sleep.
microsoft/WSL#4149

@doctorlai-msrc
Copy link

Had the same issue on WSL2, which the clock was out of sync. Solved it by running /usr/sbin/hwclock -s

@RomanshkVolkov
Copy link

RomanshkVolkov commented Feb 6, 2024

It works for me to force time zone synchronization

sudo apt-get install ntpdate
sudo ntpdate pool.ntp.org

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Account az login/account customer-reported Issues that are reported by GitHub users external to the Azure organization.
Projects
None yet
Development

No branches or pull requests

9 participants