Can't resolve the first challenge with request to Balanced Living API.
After investigating org's setup, I've found that Trailhead pre-installed a package with named credentials BalancedLiving as well as external named credentials BalancedLivingCredential.
The authorization mechanism for this challenge is much similar to the one from challenge 3 - there is a custom header with Authorization name and {!'Basic ' & BASE64ENCODE(BLOB($Credential.BalancedLivingCredential.Username & ':' & $Credential.BalancedLivingCredential.Password))} formula value. But there is nowhere to actually take both these values. The only principal with DevAccess name which is created by them contains no such parameters. I guess it's the one which is used in authorization since it's assigned to you through permission set.
The errors I receive while trying different solutions are expected.
When I'm just setting up req.setEndpoint('callout:IntegrationSB__BalancedLiving/rewards'); in the code it tells me System.CalloutException: Field BalancedLivingCredential.Username does not exist. Check spelling.
If I add Username/Password parameters to existing Principal by myself (e.g. my own login/password from the org) then the service returns { "error": "Authentication Attempt Failed" }.
The trailhead support answered me that "org is fine, just follow the instructions and check configuration article".
Maybe I'm missing something in setup but can't find it? Everything was done by their instructions
Can't resolve the first challenge with request to Balanced Living API. After investigating org's setup, I've found that Trailhead pre-installed a package with named credentials
BalancedLiving
as well as external named credentialsBalancedLivingCredential
. The authorization mechanism for this challenge is much similar to the one from challenge 3 - there is a custom header withAuthorization
name and{!'Basic ' & BASE64ENCODE(BLOB($Credential.BalancedLivingCredential.Username & ':' & $Credential.BalancedLivingCredential.Password))}
formula value. But there is nowhere to actually take both these values. The only principal withDevAccess
name which is created by them contains no such parameters. I guess it's the one which is used in authorization since it's assigned to you through permission set. The errors I receive while trying different solutions are expected.req.setEndpoint('callout:IntegrationSB__BalancedLiving/rewards');
in the code it tells meSystem.CalloutException: Field BalancedLivingCredential.Username does not exist. Check spelling.
{ "error": "Authentication Attempt Failed" }
.The trailhead support answered me that "org is fine, just follow the instructions and check configuration article". Maybe I'm missing something in setup but can't find it? Everything was done by their instructions