Can we login using `mesheryctl` without opening browser, with token or something similar

I want to login using mesheryctl command without any assistance of the broswer. Currently mesheryctl system login command opens up a browser through which we enter our details. Is there a way we can do this on the terminal only.

Well that’s an excellent idea if we can actually login meshery by simply using mesheryctl system login :thinking:. how this sound to you @Lee, @Chadha93 ?

@Yash_Sharma, yes, users can authenticate to Meshery using the mesheryctl system login command. This command requires use of a browser, however, which is the crux of @asubedy’s concern for his headless use case.

@asubedy, to achieve your use case you can sign into any Meshery Server or Layer5 Cloud and generate an API token. Download the token. Then, you can statically configure reference to that API token in your system’s meshconfig (found at ~/.meshery/config.yaml by default) using the token property.

I have raised issue #8178 to enhance Authenticating with Meshery via CLI | Meshery with additional explanation of the token property.

I did this but it’s not working. I logged into Meshery, downloaded the token then put this token file in ~/.meshery folder. the ~/.meshery/config.yaml file looks like this:

contexts:
contexts:
    local:
        endpoint: http://localhost:9081
        token: default
        platform: kubernetes
        components:
            - meshery-istio
        channel: edge
        version: v0.6.104
        provider: Meshery
current-context: local
tokens:
    - location: auth.json
      name: default

After that I stop my server and then run it again. But when I run mesheryctl system login it opens up the browser prompting me to sign in and does not authorize it automatically.

//@Lee

It’s quite likely, that the downloaded auth.json is in your ~/Downloads folder and that this reference to it in location: needs to be updated.