Basic Auth with HTTPUtils?

ggpanta

Member
Licensed User
Longtime User
Actually I am not going to use httputils since its easier to use the http library, but I have an issue with passing only a username.

In my case I get a token (not OAUTH) and then I have to use the token as the username in the authentication process.
In curld I would pass this
curl http://domain.tld -u TOKEN:
But when I set the password value of executecredentials to Null I still dont get porper auth.
Any ideas??
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
If you like to pass credentials using HttpUtils then you can modify HttpUtilsService.ProcessNextTask and change hc.Execute to hc.ExecuteCredentials.

However in your case you will need to manually implement the authentication.
You should send a regular request. The server will respond with an error code of 401. You should read the response and find the token from the headers. You can then make another request with this value as the user name.
 
Upvote 0

ggpanta

Member
Licensed User
Longtime User
I have already done that, I get the responce and send it as a username but still no go, when trying on a local nginx all seems fine, I will try and probe the other side (API devs:)

Regards.
 
Upvote 0

ggpanta

Member
Licensed User
Longtime User
Just an update,
I have solved this by doing a simple execute and setting the Authentication header manually with the token.
 
Upvote 0
Top