Skip to content

401 Unauthorized with oidc user.  #386

Closed
@pnathan

Description

@pnathan

Hi,

I'm getting a consistent 403 forbidden. This doesn't happen with the Python library or kubectl. The user is an oidc user, backed by Auth0. I have ensured that the token is valid.

I can't see any particular place where I need to pass in or set a flag. The cluster is a kops-generated cluster with its own generated certificate.

Looking at https://github.com/kubernetes-client/javascript/blob/master/src/oidc_auth.ts#L43 , I see that I have a flag in my config file extra-scopes: openid profile, which doesn't appear to be an option in the dict there. But this doesn't seem to matter in the Python library - https://github.com/kubernetes-client/python-base/blob/6b6546131217a2a9fdcf431a286c346619d2923a/config/kube_config.py#L289

First, the package.json:

    "dependencies": {
        "@kubernetes/client-node": "^0.11.0",
[snip]
        "kubernetes-client": "^0.11.0",

And for an example function:

function Example() {
    console.log(kubeconfig.currentContext); // this is correctly returned
    console.log("User", kubeconfig.getCurrentUser());   // this is the correct user object.
    console.log("Context", kubeconfig.getContextObject('Redacted'));  // This corresponds to the ~/.kube/config file.

    k8sApi.listNamespacedPod('default')
        .then((res:any) => {
            console.log(res.body.response);
        })
        .catch((error: any) => {
            // Yet, here we have 401.
            console.log("Error: ", error.response.body);
        });
}

I'm somewhat stumped here, I'm afraid.

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