login about faq

Hello, I have been given an API specification which includes an access token that maps to my user and password on the host system. I'm trying to do a simple GET. When I post the example URL below in Google Chrome it produces the correct JSON response.

http://my_token@hostdomain.net/employees/441/address.json

So I'm trying to duplicate using Chilkat Active X:

loHttp = CreateObject('Chilkat_9_5_0.Http')
lcResp = loHttp.quickgetstr("http://my_token@hostdomain.net/employees/441/address.json")

And the response is producing error 401 Unauthorized. Any clues on sending a GET with an access code?

Thanks.

asked Sep 15 '17 at 10:54

agoeddeke's gravatar image

agoeddeke
112

edited Sep 15 '17 at 10:55


I suspect Chrome is finding a Cookie and sending it with.

Are you able to use Fiddler to see what is being sent in the headers from Chrome? http://www.telerik.com/fiddler

link

answered Sep 15 '17 at 13:12

TracyP's gravatar image

TracyP
1213

OK, thanks... I'll research that angle. Just curious how Chrome knows how to set that cookie based on the access code?

(Sep 15 '17 at 13:39) agoeddeke

It may not. There might be another part to the service you are connecting to that expects it.

(Sep 15 '17 at 14:26) TracyP

Cookies are often set from within Javascript. When a browser loads HTML, it loads the HTML into a Document Object Model (DOM), and then it may run Javascript (contained withing the HTML) against the DOM. That Javascript can often create cookies, and those cookies can get sent with subsequent requests.

When using an API such s Chilkat, there is no Javascript engine. You're just receiving the HTML of the web page. If the cookies came into being via Javascript then those cookies won't exist with Chilkat. It would require far more infrastructure within Chilkat, such as building out a DOM and an embedded Javascript engine to simulate a browser.

link

answered Sep 18 '17 at 11:56

chilkat's gravatar image

chilkat ♦♦
12.8k318385543

Thank you for the response!

(Sep 19 '17 at 10:16) agoeddeke
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×203
×16
×14

Asked: Sep 15 '17 at 10:54

Seen: 506 times

Last updated: Sep 19 '17 at 10:16

powered by OSQA