How To Troubleshoot Laravel Google OAuth Not Working – InvalidStateException

  google-oauth, laravel, php

I know this question has been asked before on similar posts, but the issue I’m running into with my web app is unlike others I’ve read about on the platform. I was recently passed on a Laravel framework by my predecessor and I am somewhat experienced with PHP, but I have little knowledge of this framework (this is for a high school club by the way). Anyway, the site that I’m working with has a Google user sign-in portal, but logging in results in an InvalidStateException callback, but the unusual thing is that this issue is only happening on our school-issued Macbooks. Could the school administrator’s management of our Macbooks be affecting this? So, the portal somehow works perfectly fine when using a personal computer and logging in with the exact same school Google account. Also, I know for a fact that the portal was working fine until at least early March of 2020 (the application isn’t used all year round). And I don’t think it’s the version of Chrome causing it because my personal computer is running the latest version and as I already mentioned, it’s working there.

So far, I’ve…

  • Eliminated the possibility of the issue being the browser
  • Troubleshot using fixes on similar posts (stateless(), same-site cookies, etc.)
  • Verified that the issue isn’t caused by expired Google OAuth credentials
  • Confirmed that the portal works on literally any device besides the school-issued Macbooks
if($this->hasInvalidState()) {
    throw new InvalidStateException;
}

Any ideas would be greatly appreciated, thanks!

Source: Ask PHP

LEAVE A COMMENT