You need to sign in to do that
Don't have an account?
Ryan Raymundo 1
Unable to get Header Basic Authorization from external API call
Hello everyone,
I have created an endpoint (@RestResource), made it public, and able to accept calls which works. Now I wanted to just add some simple authentication. Since the call is from another system webhook I dont have any control, I can only check the basic auth value and compare it before I process the JSON body.
My issue is I cant get the basic authorization using this code:
RestRequest req = RestContext.request;
if (req.headers.get('Authorization') == null)
{
// always goes here
authorizationHeaderValue = 'Null';
}
Any ideas? Thanks in advance!
I have created an endpoint (@RestResource), made it public, and able to accept calls which works. Now I wanted to just add some simple authentication. Since the call is from another system webhook I dont have any control, I can only check the basic auth value and compare it before I process the JSON body.
My issue is I cant get the basic authorization using this code:
RestRequest req = RestContext.request;
if (req.headers.get('Authorization') == null)
{
// always goes here
authorizationHeaderValue = 'Null';
}
Any ideas? Thanks in advance!
As per my understanding, salesforce does not allow access to the authorization header if you are using the a salesforce login with OAuth use UserInfo.getSessionId() to get the authorization data.
Thanks,