1

I am trying to build an Instagram client for Linux. To login, I need to parse an URL like this:

http://my-host-name.com/path#access_token=TOKEN

But I can't figure out, how to get the anchor part in WebKitGTK, as get_uri() returns the URL without the anchor part, like http://my-host-name.com/path. Is there any way to retrieve it?

serge1peshcoff
  • 4,342
  • 11
  • 45
  • 76

1 Answers1

0

As I see, this is quite a popular question at StackOverflow, just not in this context. So, the anchor part only exists at the client side, so it is not sent to the backend. In this case client side means the content of the WebView, and the backend side is your Vala program.

So, it is impossible to get the anchor value. But I don't see why you would use anchors for this purpose, use URL parameters, and you will be fine.

meskobalazs
  • 15,741
  • 2
  • 40
  • 63
  • Instagram API doesn't provide returning a token via URL parameters, it just redirects user to URL with anchor. – serge1peshcoff Nov 04 '14 at 14:29
  • Actually that is not true. The documentation clearly states that you either use *implicit flow*: this is the anchor solution, or you may chose the **recommended way**, the *server-side flow*. Source: http://instagram.com/developer/authentication/ – meskobalazs Nov 04 '14 at 14:33
  • oh, I meant it doesn't provide returning a token via URL parameters without using own server, my mistake. Anyway, I don't have a server, that's why I'm using implicit flow. – serge1peshcoff Nov 04 '14 at 14:37
  • In this case, I think your only option is using it in JavaScript inside the WebView. Then, you can read the hash values from the variable `window.location.hash`. (Or writing a server application) – meskobalazs Nov 04 '14 at 14:40
  • I'll try something with Javascript. Thanks a lot for the answer! – serge1peshcoff Nov 04 '14 at 14:44