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

generic 'get access token' function #8

Open
dcooley opened this issue Sep 28, 2020 · 3 comments
Open

generic 'get access token' function #8

dcooley opened this issue Sep 28, 2020 · 3 comments

Comments

@dcooley
Copy link

dcooley commented Sep 28, 2020

I see here, for example, you look for Sys.getenv("MAPBOX_SECRET_TOKEN"). Would you consider something a bit more generic that looks for any string with "mapbox" in the environment?

Similar to what I have in mapdeck here

e <- Sys.getenv()
e <- e[ grep( "mapbox|mapdeck", names( e ), ignore.case = TRUE ) ]

(and the related thread)

@walkerke
Copy link
Owner

walkerke commented Oct 5, 2020

yes I like this a lot. The one thing I need to think through is how to handle the distinction between public tokens and secret tokens, as some tasks (e.g. uploading tilesets) require tokens with secret scope, whereas most others do not. When mb_access_token() saves the token to a user's .Renviron, it detects whether or not the token is secret and names it appropriately. I'd like to have more interoperability with other Mapbox packages though which is what your suggestion would achieve.

@dcooley
Copy link
Author

dcooley commented Oct 5, 2020

yeah good point, I hadn't considered the secret vs public tokens. But interoperability is certainly the goal where the same token can be set once and called by multiple packages.

@walkerke
Copy link
Owner

walkerke commented Oct 6, 2020

100% agree about interoperability - that's one of my priorities as I build out this package more.

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