Salesforce Superbadge: Configuring External and Named Credentials for API Callouts

  Рет қаралды 2,169

AnkitKPunjabi

AnkitKPunjabi

Күн бұрын

In this video,
I'll guide you through the process of setting up external credentials and named credentials in Salesforce, focusing on configuring authentication and making secure callouts to an external API, specifically for the Research Guardian integration.
Topics Covered:
Overview of the use case and business requirements for Max Environmental Science Institute (MESI)
Step-by-step guide to configuring external credentials
1. Setting up named credentials in Salesforce
2. Handling custom authentication headers
3. Writing Apex code for making secure API callouts
4. Debugging common issues like unauthorised headers
Whether you're working on a Salesforce superbadge or looking to enhance your Salesforce integration skills, this tutorial will provide you with the essential steps and tips to successfully configure and manage external and named credentials for secure API integrations.
Code :
public with sharing class ResearchServiceController {
public static Integer processEquipmentsRequest() {
HttpRequest req = new HttpRequest();
req.setEndpoint('callout:Research_Guardian/equipments');
req.setMethod('GET');
HttpResponse response = new Http().send(req);
if (response.getStatusCode() == 200) {
String responseBody = response.getBody();
System.debug('Available Equipments: ' + responseBody);
} else {
System.debug('Callout failed with status code: ' + response.getStatusCode());
}
return response.getStatusCode();
}
}
Connect with Me:
Instagram: ankitkpunjabi
LinkedIn: / ankitkumar007
Hashtags:
#Salesforce #Superbadge #NamedCredentials #ExternalCredentials #APIIntegration #ResearchGuardian #SalesforceDeveloper #MuleSoft #Apex

Пікірлер: 40
@manoharyenugula3997
@manoharyenugula3997 2 ай бұрын
Challenge Not yet complete... here's what's wrong: We can't find the appropriate access to the authentication tokens.
@AnkitKPunjabi
@AnkitKPunjabi 2 ай бұрын
Ops bad - In video expressions are wrong in custom header {!$Credential.Secure_Research.client_id} {!$Credential.Secure_Research.client_secret} in video expression are encode in quotes like '{!$Credential.Secure_Research.client_secret}' which is wrong. Please update your custom header and try.
@petagamer1750
@petagamer1750 Ай бұрын
Bro just go to permission set name ExtCred - MuleSoft in this object setings serach User External Credentials and give read,edit,create and after that save and go ExtCred - MuleSoft permission set in that below of obeject sents we can searchfor "External Credential Principal Access" in that select"Secure_Research - Infra Collection" then challange will be completed
@mohanvadla4341
@mohanvadla4341 Ай бұрын
please give a try adding the External Named Credential that you created(Secure_Research - Infra Collection) to the Permission set(ExtCred - MuleSoft) also .In the permission set , under this option 'External Credential Principal Access'
@umrakhan143
@umrakhan143 10 күн бұрын
hey thanks for the challenge one can you please explain me challenge 2?
@AnkitKPunjabi
@AnkitKPunjabi 8 күн бұрын
@@umrakhan143 sure whats the doubt?
@umrakhan143
@umrakhan143 8 күн бұрын
@@AnkitKPunjabi stuck 2nd challenge is this issue is that apex class is not successful
@vibowplays8716
@vibowplays8716 25 күн бұрын
Challenge Not yet complete... here's what's wrong: We can't find that authentication credentials can dynamically adapt to new credentials when rotated for the 'Secure Research' external credential.
@manoharyenugula3997
@manoharyenugula3997 2 ай бұрын
Done everything but still getting below error
@petagamer1750
@petagamer1750 Ай бұрын
Bro just go to permission set name ExtCred - MuleSoft in this object setings serach User External Credentials and give read,edit,create and after that save and go ExtCred - MuleSoft permission set in that below of obeject sents we can searchfor "External Credential Principal Access" in that select"Secure_Research - Infra Collection" then challange will be completed
@rangurajeevkumar1694
@rangurajeevkumar1694 8 күн бұрын
I am getting 401 unauthorised error. Could you please help here
@AnkitKPunjabi
@AnkitKPunjabi 8 күн бұрын
@@rangurajeevkumar1694 makes sure you have assigned external cred to your permission set
@rangurajeevkumar1694
@rangurajeevkumar1694 8 күн бұрын
@@AnkitKPunjabi The ResearchServiceController class doesn't make a successful callout.
@rangurajeevkumar1694
@rangurajeevkumar1694 8 күн бұрын
Finally I have done it.
@ashokkumarsharma5760
@ashokkumarsharma5760 22 күн бұрын
Hi @ankitKPunjabi I am following all the steps and creating permission set, public group, adding that group to 2 users everything but still I am now able to see that permission set and public group in principle access and due to this I am getting below error "Challenge Not yet complete... here's what's wrong: We can't find the appropriate access to the External Credential Principals." . can you help me in this?
@AnkitKPunjabi
@AnkitKPunjabi 22 күн бұрын
@@ashokkumarsharma5760 check external object read access and in permission set > external credential you need add your new external credential
@supriyakasukurthi7169
@supriyakasukurthi7169 2 ай бұрын
Upload platform Events superbadge unit also... That helps
@AnkitKPunjabi
@AnkitKPunjabi 2 ай бұрын
Currently working on that will be uploading shortly
@rajkarun1
@rajkarun1 Ай бұрын
@@AnkitKPunjabi Thank you Bro
@jatindersingh8342
@jatindersingh8342 Ай бұрын
Getting this error : We can’t find the appropriate access to the external credentials principals
@AnkitKPunjabi
@AnkitKPunjabi Ай бұрын
@@jatindersingh8342 you need to make sure your external credential expression is correct in custom header section
@asadshaikh1961
@asadshaikh1961 Ай бұрын
Challenge Not yet complete... here's what's wrong: The ResearchServiceController class doesn't make a successful callout. I am getting this error
@AnkitKPunjabi
@AnkitKPunjabi Ай бұрын
can you verify you external credential setting? expression should be like !$Credential.Secure_Research.client_id} {!$Credential.Secure_Research.client_secret} - in video it's bit wrong
@asadshaikh1961
@asadshaikh1961 Ай бұрын
@@AnkitKPunjabi Yes I verified it's client_id {!$Credential.Secure_Research.client_id} client_secret {!$Credential.Secure_Research.client_secret}
@asadshaikh1961
@asadshaikh1961 Ай бұрын
Still it is not working for me, receiving same error
@asadshaikh1961
@asadshaikh1961 Ай бұрын
Yeah I verified the external credentials settings and it is client_id {!$Credential.Secure_Research.client_id} client_secret {!$Credential.Secure_Research.client_secret} unfortunately still it is not working
@asadshaikh1961
@asadshaikh1961 Ай бұрын
​@@AnkitKPunjabi I verified still it is showing same error external credential setting is as below client_id {!$Credential.Secure_Research.client_id} client_secret {!$Credential.Secure_Research.client_secret}
@appleguatno6407
@appleguatno6407 Ай бұрын
Challenge Not yet complete... here's what's wrong: We can't find that authentication credentials can dynamically adapt to new credentials when rotated for the 'Secure Research' external credential.
@AnkitKPunjabi
@AnkitKPunjabi Ай бұрын
@@appleguatno6407 see that external credential you adding correctly
@mohanvadla4341
@mohanvadla4341 Ай бұрын
please give a try adding the External Named Credential that you created(Secure_Research - Infra Collection) to the Permission set(ExtCred - MuleSoft) also .In the permission set , under this option 'External Credential Principal Access'
@kappagosu4544
@kappagosu4544 Ай бұрын
@@mohanvadla4341 did that and still same fail​ ankit skipped a step from somewhere
@husnuozaltun3477
@husnuozaltun3477 Ай бұрын
use these {!$Credential.Secure_Research.client_id} and {!$Credential.Secure_Research.client_secret} instead fo hard ones on the headers.
Master Salesforce API Integration with Platform API Superbadge!
22:00
AnkitKPunjabi
Рет қаралды 3,4 М.
Apex Callouts with Improved Named Credentials | Mini Hacks Solved | Season 02
25:30
小丑妹妹插队被妈妈教训!#小丑#路飞#家庭#搞笑
00:12
家庭搞笑日记
Рет қаралды 35 МЛН
Je peux le faire
00:13
Daniil le Russe
Рет қаралды 19 МЛН
Остановили аттракцион из-за дочки!
00:42
Victoria Portfolio
Рет қаралды 2,7 МЛН
АЗАРТНИК 4 |СЕЗОН 2 Серия
31:45
Inter Production
Рет қаралды 1 МЛН
API Gateway vs Load Balancer vs Reverse Proxy: when to use what?
9:06
Software Developer Diaries
Рет қаралды 16 М.
Named Credentials Superbadge Unit | Challenge 1
14:57
Salesforce ThunderBird
Рет қаралды 1,8 М.
Why Agent Frameworks Will Fail (and what to use instead)
19:21
Dave Ebbelaar
Рет қаралды 59 М.
User Authentication ||Secure Your Users’ Identity
8:41
trailhead Challenge
Рет қаралды 34 М.
Platform Events Superbadge Unit | Challenge 1 | Solution
31:49
Salesforce ThunderBird
Рет қаралды 918
小丑妹妹插队被妈妈教训!#小丑#路飞#家庭#搞笑
00:12
家庭搞笑日记
Рет қаралды 35 МЛН