Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Salesforce by (11.9k points)

I am trying to do basic authentication to call a rest service.

On service doc the procedure mentioned for CURL is like this:

curl -X POST https://secure.clientservice.com/api/transactions.json -u [TOKEN]:[KEY] -H 'Content-type: application/json' \

-d "{\"transaction_type\":\"request\",\"amount_in_cents\":\"3000\",\"email\":\"[email protected]\"}"

I got stuck how to send the [TOKEN]:[KEY] for authentication from chrome rest client. I am having both user token and key and doc is saying I have to do Http Basic access authentication

On rest explorer I am trying like below:

enter image description here

But this is giving unauthorized access as seems to be the Authorization header is wrong where I am encoding [axkKtfBAaPABCh59SA]:[S7RwBG2eZ3y8mDs8VS] this value to base 64. Am I doing in the right way or am I missing something?

1 Answer

0 votes
by (32.1k points)

You can do the basic HTTP access authentication from advance rest client as follows:

Add the Authorization header: 

Header Forms --> ADD HEADER --> Begin typing in Authorization.

enter image description here

Add the basic auth info by clicking on the Edit (pencil) button on the right. 

A form to fill credentials will pop up: enter image description here

Advanced REST Client will take care of encoding

Browse Categories

...