You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 3, 2024. It is now read-only.
I did some more digging and uncovered the mystery of the 401 response.
When the SecretClient is created, it apparently is not fetching an auth token before attempting to access the resource. See the first screenshot, a request to https://example-key-vault-1.vault.azure.net/secrets?api-version=7.2, that has no authorization header. It returns 401: Unauthorized.
The SecretClient seems to have some retry logic built in, so it sees 401 and goes on to fetch a token from /oauth2/v2.0/token
Then the SecretClient tries to list the secrets again (this time with an authorization header, and succeeds with 200: Success
If you review the recording, you’ll see that the secrets from dhaiwat-vault are going through the same process, although it receives a 403 rather than a 200 (which the code appropriately handles): 401 > /oauth2/v2.0/token > 403.
Basically, this means that every time we try to list keys or secrets, we’re going to hit a 401, then try to fetch a new token, then get an actual response (200, 403, etc). I’m going to open a ticket to fix the behavior and I’ll assign to you for some future PR. But now that the confusion is resolved i’m ready to get this one merged.
I did some more digging and uncovered the mystery of the 401 response.
When the
SecretClient
is created, it apparently is not fetching an auth token before attempting to access the resource. See the first screenshot, a request tohttps://example-key-vault-1.vault.azure.net/secrets?api-version=7.2
, that has noauthorization
header. It returns401: Unauthorized
.The
SecretClient
seems to have some retry logic built in, so it sees401
and goes on to fetch a token from/oauth2/v2.0/token
Then the
SecretClient
tries to list the secrets again (this time with anauthorization
header, and succeeds with200: Success
If you review the recording, you’ll see that the secrets from
dhaiwat-vault
are going through the same process, although it receives a403
rather than a200
(which the code appropriately handles):401
>/oauth2/v2.0/token
>403
.Basically, this means that every time we try to list keys or secrets, we’re going to hit a
401
, then try to fetch a new token, then get an actual response (200
,403
, etc). I’m going to open a ticket to fix the behavior and I’ll assign to you for some future PR. But now that the confusion is resolved i’m ready to get this one merged.Originally posted by @ndowmon in #435 (comment)
The text was updated successfully, but these errors were encountered: