vignettes/manageSynapseCredentials.Rmd
manageSynapseCredentials.Rmd
There are multiple ways one can login to Synapse. We recommend users to choose the method that fits their workflow.
Use username and password to login as follows:
library("synapser")
synLogin("username", "password")
Alternately you can login using a personal access token obtained from synapse.org under your Settings. Note that a token must minimally have the view scope to be used with synapser.
library(synapser)
synLogin(authToken="authtoken")
.synapseConfig
For writing code using the synapser
client, that is easy
to share with others, please do not include your credentials in the
code. Instead, please use .synapseConfig
file. You can
refer your collaborators to the following documentation on how to set up
a .synapseConfig
file.
First, create a .synapseConfig
file in your home
directory with the following content:
[authentication]
# either authtoken OR username and password
authtoken = <authtoken>
username = <username>
password = <password>
You can choose to specify either username
and
password
or authtoken
. For security purposes,
we recommend that you use authtoken instead of your password. A personal
access token generated from your synapse.org Settings can be used as
your .synapseConfig authtoken.
Then login without specifying your username and password:
library("synapser")
synLogin()
For legacy compatibility, the .synapseConfig
[authentication]
section also supports apikey
,
which can be used instead of username
+
password
pair, or authtoken
, however apikey
support in the .synapseConfig is considered deprecated in favor of
personal access tokens (authtoken) which can be scoped to certain
functions and are revocable. If needed, your legacy apikey can also be
obtained from your synapse.org Settings.
For users who would like to save their credentials and let other OS configured applications (like keychain in Mac) manage credentials for them, when logging in for the first time, use:
library("synapser")
synLogin("username", "password", rememberMe=True)
The application (keychain in Mac) will then prompt you to allow other applications including Python and R to access these credentials. Please choose “Yes” or “OK”.
The second time you login, you will not have to enter your username or password:
library("synapser")
synLogin()