You can associate your OAuth credentials with a specific site from within your CloudSponge account. But what do you do if you want a site to use different credentials depending on the URL path? Never fear, oauthCredentials
option is here!
You can suggest the name of the credential(s) that you’d like to use by assigning it to this option. Our system will search in your account for a credential that matches that name.
You can use the oauthCredentials
option in two ways: give it an array or a string.
For example, as an array:
cloudsponge.init({
// look for the 'Google OAuth' credential or the 'Yahoo OAuth' credential
// of course, we will only use a Google credential for a Google address book
oauthCredentials: ['Google OAuth', 'Yahoo OAuth']
});
For convenience, we accept a string in place of an array with a single entry:
cloudsponge.init({
// look for a credential named 'Google OAuth'
oauthCredentials: 'Google OAuth'
});
This option is safe because it falls back to the regular way of determining which credential to use. We attempt to match in this order:
- Look for a matching name listed in the
oauthCredentials
option (in the order specified), - Look for a credential associated with the current site,
- Look for a default credential for the account,
- Look for a shared credential.