When I log in, how do I get the user back to the pre-login interview? How to give value to others?

I have a problem now
when a user clicks on a link and goes to the login window, I will add his previous address, such as

, to the web address.
https://ha.xyz.com/signin?request=https://ha.xyz.com/products/121111

and then log in to the noodle shop, which will allow the user to choose whether to log in or EMAIL login
, so the click on the link will be

.
https://www.facebook.com/v3.0/dialog/oauth?client_id=xxx&state=aaa&response_type=code&sdk=php-sdk-5.6.2&redirect_uri=https%3A%2F%2Fha.xyz.com%2F%2Fvendor%2Fsdk%2Ffacebook%2Flogin-callback.php&scope=email

the generation of this connection is the oauth of facebook

require_once "/vendor/autoload.php";

  $fb = new Facebook\Facebook([
  "app_id" => "xxx",
  "app_secret" => "aaa",
  "default_graph_version" => "v3.0",
  ]);

  $helper = $fb->getRedirectLoginHelper();

  $permissions = ["email"];

$loginUrl = $helper->getLoginUrl("".$host_url."/vendor/sdk/facebook/login-callback.php", $permissions);

the question is how can I give him request ?
he $loginUrl generates an address structure that cannot be plugged into
at all, and the existence of $_ GET ["request"] can be determined only after login-callback.php authentication is successful!

Apr.11,2021

Please var_dump ($loginUrl)

talk about the oauth authorization process

  1. website constructs oauth2.0 authorization link and redirects to facebook login page
  2. user agrees to log in facebook with code redirect to the callback link in step 1
  3. get code in the callback link plus appid and secret request facebook to get the user access_token
  4. request user data using user access_token

you can say which step is stuck now

Menu