Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mapbox Tokens in Shiny? #63

Closed
mrworthington opened this issue Apr 7, 2022 · 2 comments
Closed

Mapbox Tokens in Shiny? #63

mrworthington opened this issue Apr 7, 2022 · 2 comments

Comments

@mrworthington
Copy link

Hi,

I've loaded an R Deck into shinyapps.io. Everything works fine, except I can't seem to figure out a way to get my map box key to be read on shinyapps.io, so locally, you can see the mapbox tiles, but when it's hosted, the tiles are missing. Is there a way to do something akin to the following and have that token stored from the local environment onto the shiny app that gets hosted?

token <- Sys.get("MAPBOX_ACCESS_TOKEN")

rdeck::mapbox_access_token(token)

Local Render

Screen Shot 2022-04-06 at 9 24 54 PM

Shinyapps.io

Screen Shot 2022-04-06 at 9 25 12 PM

@anthonynorth
Copy link
Member

anthonynorth commented Apr 7, 2022

Mapbox token can be set via environment variable MAPBOX_ACCESS_TOKEN or with option rdeck.mapbox_access_token. In shiny (own server, not shinyapps), we set the token via environment variable with {dotenv}.

I haven't used shinyapps, but I'm surprised it doesn't support supplying environment variables.

Edit: It appears that shinyapps supports .Renviron, so you might just put your token there.

@mrworthington
Copy link
Author

Got it. That's what I did. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants