Skip to content

Commit a8914b7

Browse files
committed
oidc client auth: better error when refresh response is missing id_token
1 parent 086bda6 commit a8914b7

File tree

1 file changed

+5
-1
lines changed
  • staging/src/k8s.io/client-go/plugin/pkg/client/auth/oidc

1 file changed

+5
-1
lines changed

staging/src/k8s.io/client-go/plugin/pkg/client/auth/oidc/oidc.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,11 @@ func (p *oidcAuthProvider) idToken() (string, error) {
258258

259259
idToken, ok := token.Extra("id_token").(string)
260260
if !ok {
261-
return "", fmt.Errorf("token response did not contain an id_token")
261+
// id_token isn't a required part of a refresh token response, so some
262+
// providers (Okta) don't return this value.
263+
//
264+
// See https://github.com/kubernetes/kubernetes/issues/36847
265+
return "", fmt.Errorf("token response did not contain an id_token, either the scope \"openid\" wasn't requested upon login, or the provider doesn't support id_tokens as part of the refresh response.")
262266
}
263267

264268
// Create a new config to persist.

0 commit comments

Comments
 (0)