oauthCredentials

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 'Gmail OAuth' credential or the 'Yahoo OAuth' credential
  // of course, we will only use a Gmail credential for a Gmail address book
  oauthCredentials: ['Gmail 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 'Gmail OAuth'
  oauthCredentials: 'Gmail 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:

  1. Look for a matching name listed in the oauthCredentials option (in the order specified),
  2. Look for a credential associated with the current site,
  3. Look for a default credential for the account,
  4. Look for a shared credential.