There are multiple ways one can login to Synapse. We recommend users choose the method that fits their workflow best.
Use the synLogin() function.
.synapseConfigFor writing code using the Synapse R Client (synapser)
that is easy to share with others, please do not include your
credentials in the code. Instead, please use the
~/.synapseConfig file to manage your credentials.
The Synapse R Client supports multiple profiles within the
~/.synapseConfig file, enabling users to manage credentials
for multiple accounts. Each profile is defined in its own
[profile <profile_name>] section. A default profile
can still be defined using [default].
~/.synapseConfig fileOpen the ~/.synapseConfig file using your preferred text
editing tool and find/insert the following section(s):
[default]
username = default_user
authtoken = default_auth_token
[profile user1]
username = user1
authtoken = user1_auth_token
[profile user2]
username = user2
authtoken = user2_auth_token
# This section is deprecated. It will be used if a `default` profile or a specific profile is not present in the config file
#[authentication]
#username = default_user
#authtoken = default_auth_token
username is optional when using authtoken,
but if provided, an additional check to verify the
authtoken matches the username is
performed.
The authtoken is also known as a personal access token.
It is generated from your synapse.org
Settings.
If you’re currently using a single profile (under the
[default] or [authentication] section) and
wish to start using multiple profiles, simply add new sections for each
profile with a unique profile name. For example, you can add a profile
for user1 and user2 as shown below. The Synapse R Client will allow you
to choose which profile to use at login.
[default]
username = default_user
authtoken = default_auth_token
[profile user1]
username = user1
authtoken = user1_auth_token
[profile user2]
username = user2
authtoken = user2_auth_token
Note: If no profile is specified the
default section will be used. Additionally, to support
backwards compatibility, authentication will continue to
function. authentication will be used if no profile is used
and default is not present in the configuration file.
If you want to log in with a specific profile, simply pass the
profile name as an argument to synLogin():