cancel
Showing results for 
Search instead for 
Did you mean: 

Username / password auth via post request

Matthias
New Contributor III

We've got a service that needs authentication via Post/Put request with the following body:

```

{
"U":"someUsername",
"P":"someSecurePassword",
"L":"EN"
}
```
 
Now with the rest post snap, i can  store the data in a "basic auth" account, and use the following:
``` 
'{
"U":"' + account.username + '",
"P":"' + account.password + '",
"L":"EN"
}'
```
now reading the Rest Api documentation, it is pointing me to use the HTTP client - which i tried, but this doesn't seem to give this option? 

is there any way to accomplish the same thing with the HTTP client snap?
 
6 REPLIES 6

alchemiz
Contributor III

Hi @Matthias ,

Good day, I don't know if this helps but you can also set basic authentication through the http header 
e.g

Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ (encoded base64 username:password)


Matthias
New Contributor III

well that's kindof the opposite of what i need
the endpoint i need to connect to doesn't accept Basic auth - but requires the username / password to be provided via post body.

SpiroTaleski
Valued Contributor

@Matthias 

The HTTP Client Snap can use the Basic Authentication Account. 

Did you try to reference the credentials in the "Raw entity" field within the snap? 

Spiro_Taleski_0-1693828173330.png

BR, 

Spiro Taleski

yeah i did - unfortunately to no avail, as "account." is unknown in the http client snap