deep-entertainment / issues

Issue tracker for deep Entertainment projects
1 stars 0 forks source link

GodotTPD: Cannot parse hash from URL #41

Closed JDDoesDev closed 10 months ago

JDDoesDev commented 10 months ago

Project:

GodotTPD

Describe the bug When trying to parse data from the Twitch API when performing an Implicit Auth workflow I am unable to parse anything past the initial # character. Here is the URL that I am attempting to use (taken from the docs)

http://localhost:18297/
  #access_token=73d0f8mkabpbmjp921asv2jaidwxn
  &scope=channel%3Amanage%3Apolls+channel%3Aread%3Apolls
  &state=c3ab8aa609ea11e793ae92361f002671
  &token_type=bearer

If I change the # to a ? then I can parse all of the params, however leaving as a # prevents any of the GodotTPD scripts from reading it.

I am trying to read it from the initial point of the request within http_server.gd by using print(request_string) in _process() which returns

GET / HTTP/1.1
Host: localhost:18297
Connection: keep-alive
Cache-Control: max-age=0

when the leading # is present and

GET /?access_token=73d0f8mkabpbmjp921asv2jaidwxn&scope=channel%3Amanage%3Apolls+channel%3Aread%3Apolls&state=c3ab8aa609ea11e793ae92361f002671&token_type=bearer HTTP/1.1
Host: localhost:18297
Connection: keep-alive

when I change the # to a ? for testing.

Expected behavior I can parse all parameters after the #

Versions

dploeger commented 10 months ago

That's a very strange thing to do, Twitch API. 😆 I had to actually take a look at the RFC and the pound sign isn't supported at all. It's a browser thing (see https://stackoverflow.com/questions/55435400/handling-pound-sign-in-python-requests as well)

So there's basically nothing I can do, the Twitch API there is targeted at browsers, not servers.

You should be using the client credentials grant workflow instead, I'd say.