Coder Social home page Coder Social logo

Comments (7)

weinong avatar weinong commented on August 28, 2024 1

@sleterrier did you try -l interactive?

from kubelogin.

weinong avatar weinong commented on August 28, 2024 1

@sleterrier You are good now, right? please reopen for follow up

from kubelogin.

bcho avatar bcho commented on August 28, 2024

Just to confirm, are you using device code authentication in this case?

from kubelogin.

sleterrier avatar sleterrier commented on August 28, 2024

That is correct. Using distinct --server-id and client-id if that also matters (with clientApp granted user_impersonation permission on serverApp).

from kubelogin.

bcho avatar bcho commented on August 28, 2024

I guess the culprit is kube-login is using adal SDK here:

emptyToken := adal.Token{}
client := &autorest.Client{}
deviceCode, err := adal.InitiateDeviceAuth(client, p.oAuthConfig, p.clientID, p.resourceID)
if err != nil {
return emptyToken, fmt.Errorf("initialing the device code authentication: %s", err)
}

We might need to update the SDK to make it support the v2 endpoint. But not sure the back compatibility here. Will discuss more with my team mate on this.

from kubelogin.

sleterrier avatar sleterrier commented on August 28, 2024

Thank you for looking into this @bcho, much appreciated ❤️

from kubelogin.

sleterrier avatar sleterrier commented on August 28, 2024

@weinong I had not, but confirm it allows azure-kubelogin to get tokens from the v2 endpoint! Thank you 🎉

Here are some details others might find useful:

  • kubelogin get-token \
    --environment AzureUSGovernmentCloud \
    --server-id <server-app-id> \
    --client-id <client-app-id> \
    --tenant-id <tenant-id> \
    --login interactive
    
  • Despite successful in-browser authentication, my initial attempts were failing with:

    Error: failed to get token: expected an empty error but received: InteractiveBrowserCredential authentication failed
    POST https://login.microsoftonline.us/<tenant-id>/oauth2/v2.0/token
    --------------------------------------------------------------------------------
    RESPONSE 401 Unauthorized
    --------------------------------------------------------------------------------
    {
      "error": "invalid_client",
      "error_description": "AADSTS7000218: The request body must contain the following parameter: 'client_assertion' or 'client_secret'.",
      "error_codes": [
        7000218
      ],
      "timestamp": "2023-08-29 02:59:54Z",
      "trace_id": "obfuscated",
      "correlation_id": "obfuscated",
      "error_uri": "https://login.microsoftonline.us/error?code=7000218",
      "claims": "{\"access_token\":{\"capolids\":{\"essential\":true,\"values\":[\"obfuscated\"]}}}"
    
  • Which was due to an incorrect platform configuration on <client-app-id>. See MicrosoftDocs/azure-docs#61446 for details, TLDR: Mobile and Desktop applications is needed, not Web.

from kubelogin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.