Named Credentials - A turning point for callouts in Apex
What are Named Credentials?
- Specifies the URL of a callout endpoint and its required authentication parameters(methods & urls) with point & click.
- Can be seen as advance version of remote site settings in one scenario but it has totally different purpose. Remote site settings are not required for this.
- Named credentials handles all authentication requirements like headers to be set etc.
- It is an alternate of using remote site settings with apex code handling. It is much more secure.
- Supports two types of authentication protocols for now : Basic Authentication(Password authentication) or OAuth.
- Can be configured easily if Authentication needs to be done in User Context or Admin Context
OAuth Protocol:
This requires a proper setup of Auth provider in salesforce with configurations like consumer key, consumer secret, callback url.
We can also connect two orgs with this method.To connect with another salesforce, connected app needs to be created in one org & Auth provider & named credentials need to be configured in another.
Comments
Post a Comment