pachadotdev / analogsea

Digital Ocean R client
https://pacha.dev/analogsea/
Apache License 2.0
154 stars 24 forks source link

do_auth #3

Closed karthik closed 10 years ago

karthik commented 10 years ago

Auth issues

  1. do_auth. Good idea to add a package prefix to avoid namespace conflict but this is a pretty generic function name. I understand do stands for Digital Ocean. You might have to get creative here.
  2. The examples for do_auth are outdated.
library(analogsea)
client_id = "xxxxxxx"
api_key = "yyyyyyy"
do_auth()
Couldn't find env var DO_CLIENT_ID. See ?do_auth for more details.
Couldn't find env var DO_API_KEY See ?do_auth for more details.
Please enter your CI and press enter:
: xxxxx
Updating DO_API_KEY env var
[1] "yyyyy"

The example for ?do_auth says:

## Not run: 
client_id = '<client id>'
api_key = '<api key>'
do_auth(client_id=client_id, api_key=api_key)

This doesn't actually work because it still requires an inline key/secret to be pasted.

hadley commented 10 years ago

I think it would also be better to store the auth key in an option rather than environment variable.

sckott commented 10 years ago

Thx-I'll update the example for auth

hadley commented 10 years ago

Should do_auth() be run automatically? It's handy to be able to run it manually so you can troubleshoot your setup, but after that, why not run automatically?

karthik commented 10 years ago

I agree that it should run automatically when some other function requiring auth runs. Just like how Carl has now set it up with rfigshare.

sckott commented 10 years ago

True, authenticating automatically makes sense

karthik commented 10 years ago

Also if you store these in options make sure it's something less generic than api_key and client_id.

sckott commented 10 years ago

auth is already set up to happen automatically via do_get_auth() which runs do_auth() if id and key are not found