pins: Programmatically determining my username

I'm using pins and can't figure out my name :wink:

So I've got:

pin(x, name = pin_name, board = "rsconnect")

How do I retrieve the pin? To use pin_get I need to know my Connect username. So this fails

pins::pin_get(pin_name, board = "rsconnect")


pins::pin_get(paste0("username/", pin_name), board = "rsconnect")

is OK.

Hi Colin,

Sorry that you're having trouble with this. Have you already registered RStudio Connect as a board in this session?
Looking through the Using RStudio Connect Boards vignette, it seems like having multiple servers or accounts available could require additional steps:

If you happen to have multiple RStudio Connect servers registered, you will have to specify the server parameter. Similarly, when multiple accounts are registered, you will need to specify the account parameter.

# register when multiple servers are available
board_register_rsconnect(server = "https://rstudio-connect-server")

# register when multiple accounts are available
board_register_rsconnect(account = "account-name")

That said, I'm not sure why pins::pin_get(paste0("username/", pin_name), board = "rsconnect") would work in this scenario if you hadn't. I'm gonna tag @javierluraschi in, since I'm sure he'll know whether or not you should file this as an issue.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

Hi @mara. Sorry, I wasn't clear.

I'm after a programmatic way of determining my username. So

pins::pin_get(paste0("username/", pin_name), board = "rsconnect")

works, but is there a function that tells me "whoami"? Hope that makes sense

BTW, I just got

1 Like

Ah, I see! So, beyond

board_register_rsconnect(key = "the-rstudio-connect-api-key",
                         server = "https://rstudio-connect-server")


board_register_rsconnect(key = Sys.getenv("CONNECT_API_KEY"),
                         server = Sys.getenv("CONNECT_SERVER"))

(or a more secure way that I don't know about—though I've learned a lot from virtually following your R-security/standup-comedian tour), you also need to have a way to get the username from…somewhere.

At the very least, I'd say this is a hard one to crack from my naïve reading of the documentation. So, at the very least, I think an issue for improved/easier-to-find docs would be warranted.

I'm gonna leave it to you to file, since I don't want to lose nuance, and I know you're an old hand at these things!

:tada: Congrats on your first emoji usage!

1 Like