OAuth CLI login

At the moment I do not know how I can login with github when I use the CLI, preventing me from publishing a library.

Is there a way to log into your Account using the CLI when your account uses OAuth?
If not would it be possible to log into the CLI tool using the browser (the cli tool generates a link which can be opened to log into your account in the browser and authorize the cli tool to use your account)?

Why would you want to login into Github for publishing a library? The pio package publish commands take paths on the local harddrive to the source code folder.

>pio package  publish --help
Usage: pio package publish [OPTIONS] <source directory, tar.gz or zip>

  --owner TEXT            PIO Account username (can be organization username).
                          Default is set to a username of the authorized PIO
  --released-at TEXT      Custom release date and time in the next format
                          (UTC): 2014-06-13 17:08:52
  --private               Restricted access (not a public)
  --notify / --no-notify  Notify by email when package is processed
  -h, --help              Show this message and exit.

Just clone it and pio package publish <path to library> (while being normally logged into you PIO account via pio account login)

Instead of creating a new pio account it is possible to login with github using OAuth (at least on the website for the forum and everything).
That way you don’t need to create a new password and can have features like 2FA because you need to log into you github account to access you pio account.
However that way your platformio account does not have a password, so it seems like it is not possible to log into your account using the cli which is needed to publish a library.

“It is”? Can you link your source for being able to use a Github OAuth login procedure to log into your pio account , because I’m entirely unaware of that. I’m kinda lost on what the question / error here is.

Of course PIO accounts are password protected o_o

“It is”? Can you link your source for being able to use a Github OAuth login procedure to log into your pio account , because I’m entirely unaware of that. I’m kinda lost on what the question / error here is.

Just open the login page for the forum. There is a login with github button among others, all of those should create and log into an pio account using OAuth. When you login or register using OAuth the other service handles the password management including 2FA and all pio gets from that other service is an email, user name and some kind of token. That way you can have a pio account without it having a password because of the way OAuth works (look here for more details).

The question is whether you can log into the CLI using OAuth.

Okay I think I understand the question now. You’ve logged in here by using the “Log in via Github” option on the login page. So you don’t even know the password to your PlatformIO account and can’t use pio account login and subsequently pio package publish to publish the library.

I’m honestly not sure how the authentication flow works there. Maybe the “Forgot Password?” link will allow you to get a reset password email by which you can then set one? I don’t think pio account login is capable of also using a “Login via Github” option and you need the username and password for this.

Anyways I think @ivankravets can help here the most.

1 Like

Yes, please run pio home and click on the “Account” icon in the right top corner. Does it work?


Yes it works, thank you.

1 Like

@ivankravets I’ve hit the same issue with Github auth. I just tried “pio home” as you suggested, but when I click on the “Account” icon, I get nginx Bad Gateway. Is there anything else I can try? Thanks!

I’ve just tried again and I’m able to log into PlatformIO Home now.

I’ve just unlinked your Github account. Please try again. Did it help?

Using oauth providers is great for the forum, but has some things which break elsewhere.

pio pkg publish → requires a username:

Error: Please set a username for your account using the next command:

You can’t use any of the tools to update your account, since there is no password. Even with “pio home” you can’t edit your profile (to add a username) since it requires entering a password.

What did work was “pio account destroy” (after logging in via “pio home”), and setting up a traditional account with username, email, password. It would have been neat to just use a secure authentication provider though.

You can just “Forgot password” with your email and you will receive both types of authentication: OAuth + password-based.