0

I am very new to PHP and would like to build a web app for my school.

I have got the oauth down, and my redirect URl is

127.0.0.1/authorize

This results in, when succesfulyl authenticated, 127.0.0.1/authorize/#access_token=thenmycodehere

Now, being new to PHP, I cannot figure out how to get the access_token variable.

If the # was a ?, then I could do it.

Is it possible?

exec("python getlinks.py " . $_GET["access_token"]);

Will B
  • 19
  • 3

1 Answers1

0

You cannot.

Browser won't even send a request with a hash part.

Only way is just send this access_token using some clientside js code.

To somebody saying it's possible - I want to prove that it's not!

Here is the prove:

1) create hash.php file and put this contents:

<?php

echo "SERVER<br/>";
var_dump($_SERVER);
echo "<hr/>";
echo "REQUEST<br/>";
var_dump($_REQUEST);

2) go to link and check: http://num8er.me/hash.php#access_token=blablabla

num8er
  • 18,604
  • 3
  • 43
  • 57
  • Is it possible to perhaps, get the url, then removes everythings before the access token? The access token is the very last thing in the url, and always has an = before it – Will B Sep 21 '16 at 10:44
  • Dear @WillB just have some clientside code that will get it from window.location.hash and send to backend using ajax. – num8er Sep 21 '16 at 10:54