Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to do Http Basic access authentication from advance rest client

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 un authorized 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 right way or am i missing something.

like image 219
Rajasekhar Avatar asked May 17 '16 10:05

Rajasekhar


People also ask

How do I set up HTTP basic authentication?

For HTTP basic authentication, each request must include an authentication header, with a base-64 encoded value. Where siteName is the company name you use to log in to Eloqua, and username and password are your Eloqua username and password.

How can I pass the basic HTTP authentication or token authentication?

You need to generate a Base64-encoded credential with the Customer ID and Customer Secret provided by Agora and pass the credential to the Authorization parameter in the request header.

How do I authenticate an HTTP request?

A client that wants to authenticate itself with the server can then do so by including an Authorization request header with the credentials. Usually a client will present a password prompt to the user and will then issue the request including the correct Authorization header.


Video Answer


3 Answers

Add the Authorization header: Header Forms --> ADD HEADER --> Begin typing in Authorization.

enter image description here

and 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

like image 156
sag Avatar answered Nov 12 '22 09:11

sag


I think should encode without the "[" “]“, it could be your problem. Also verify that your token is still valid (it could be expired)

if this doesn't solve your problem can you provide me the error message you get (in your picture the result seems to be ok).

like image 44
EmCode Avatar answered Nov 12 '22 10:11

EmCode


This is an Old question, and has been answered as to how this should be done in Advanced REST Client. But i would still like to point out that you need to enter the basic Authentication Header like this: Header Name: Authorization Header Value: Basic

so if your username was user1 and password was abc then you would need to find the base64 encoded value of "user1:abc" which is "dXNlcjE6YWJj" (you can do this in one of many online tools available, just serach for "base 64 encode online"). In this case your header will become like: Authorization -> Basic dXNlcjE6YWJj

like image 27
Peeyush Goela Avatar answered Nov 12 '22 09:11

Peeyush Goela