You need to sign in to do that
Don't have an account?
Mahesh Tandan 6
Basic Callout in salesforce
Hello guys.
I'm typing to get paypal access token and paypal uses basic auth
how can I post Basic auth in salesforce callouts
do I need to put it in request.setHeader('username','sldkj88***');
or in body request.setBody('username','sldkj88***');
I'm typing to get paypal access token and paypal uses basic auth
how can I post Basic auth in salesforce callouts
do I need to put it in request.setHeader('username','sldkj88***');
or in body request.setBody('username','sldkj88***');
Please try the below one:
string username = 'sldkj88***';
string password = '*********';
Blob headerValue = Blob.valueOf(username + ':' + password);
String authorizationHeader = 'Basic ' + EncodingUtil.base64Encode(headerValue);
req.setHeader('Authorization', authorizationHeader);
Thanks,
Maharajan.C
All Answers
Please try the below one:
string username = 'sldkj88***';
string password = '*********';
Blob headerValue = Blob.valueOf(username + ':' + password);
String authorizationHeader = 'Basic ' + EncodingUtil.base64Encode(headerValue);
req.setHeader('Authorization', authorizationHeader);
Thanks,
Maharajan.C
Thank you so much for your Help your code really worked for me
I need one more favor from you please help
this is my visualforce code I want to send this to my controller how can I do this
alert('Order Id '+ data.orderID);
https://developer.salesforce.com/forums/?id=906F000000097TTIAY
https://salesforce.stackexchange.com/questions/24666/how-to-pass-javascript-value-to-controller
https://salesforce.stackexchange.com/questions/218097/how-to-pass-javascript-variable-value-in-apex-controller
Thanks,
Maharajan.C