generic 'get access token' function
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)
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.
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.
100% agree about interoperability - that's one of my priorities as I build out this package more.