Symfony 4 – User is null on callback route from external service

On Symfony 4, when catching a callback route from any 3rd party service (in this case – Shopify API), my logged in user becomes anon. so I cannot update it.

  • (HTTP): It works when testing on localhost
  • (HTTPS): However, my logged in User becomes null / Anonymous when testing on my remote server (prod).

How do I fetch my logged in user after catching a callback route from any external service? I think it could be a problem with either HTTP vs HTTPS or some Symfony settings.


On Shopify API dashboard – Allowed redirection URL(s):

http://localhost:8000/shopify/callback
https://<myremoteip>.com/shopify/callback

Symfony Controller Route (for Shopify callback):

/**
* @Route("/shopify/callback", name="shopify_callback")
*/
public function shopify_auth_callback(Request $request)
{
    dd($this->getUser());
}

Callback Result (localhost):

AppEntityUser {#977 ▼
   -id: 103
   -email: "[email protected]"
}

Callback Result (remote):

null

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *