I have been using Socilte package for users login, i m using facebook, google, twiter and github API. All other API’s are working fine expect google API, it is showing an error while returning from google.
HTTP Error 403 – Forbidden
The Web server is configured to not list the contents of this directory or you do not have enough permissions to access the resource.
This is my callback function, in fact it is not reaching this callback function:
public function handleGoogleCallback()
{
$user = Socialite::driver('google')->stateless()->user();
}
2
Answers
The reason for getting this error is because Google+ API is not enabled, go on google console account and enable Google+ API.
Open your Google Console Account from Here:console.developers.google.com
Then Go to -> library -> select Google+ API -> Enable
NOTE: If this is not working please change the hosting server and try it
I was facing the same problem couple of days back. Even googling it didn’t solve my problem.
So i decided to go indepth of it and guess what, i found the appropriate reason of this issue.
In my case the reason was the word .profile in google callback URL.
I had a conversation with my hosting provider(Hostgator) regarding this and initially they were saying that this issue is in the code not by their side. But i had enough evidence(i did show them by changing .profile to .abc and huaa… issue gone..) to show them that this issue is from server end. Then they were pitching me for VPS hosting(i have shared hosting) but i denied to take it then finally they accepted that they have a mod_security rule that is preventing the word .profile from security reason.
They have a weired mod_security rule of course.
When i got that they are not going to change mod_security rule for me then i altered socialite core package
and commented profile here
then everything was good except i couldn’t get username because of commenting profile but for me it was good to go. So this could be a trick to get rid of bad server rules.