Trying to add Google sign in api to octobercms

- 1 answer


I'm using OctoberCMS based on Laravel freamwork.

I would like to have option on my website "sign in with google account".

So I went to and I fallowed all of the steps to "Authenticate with a backend server". Becouse I don't have ssh access to my domain ( I cannot install library using Composer), so I downloaded Google API Client Library for php in .zip .

I unpacked it to 'plugins/nameOfMyplugin/google'.

And I got stuck,becouse I don't have any idea how to Send the ID token to my server and to validate it with those library, then I would like to create new user in my db if not exist in my rainlab.user.plugin.

Thank You for any help.




I have solved it.

In octoberCMS there is no reason for connect with google api by Your own, better solusion is download already made plugin( which is working.

I just downloaded, but as I said it before, got some problems with login into my website.

I sow that each 12 minutes break between log out and log into my website I can login. When I tried to log into after in 11 minutes after log out it didn't work.

I went to my backend/ settings / logs /event logs and sow that

Cannot handle token prior to 2017-04-19T08:27:14+0000 in public_html/plugins/flynsarmy/sociallogin/vendor/firebase/php-jwt/src/JWT.php on line 124.

It's mean that my server time have 12 minutes late. There are 2 ways to solve it:

First one not good for safety reasons:

SET in plugins/flynsarmy/sociallogin/vendor/firebase/php-jwt/src/JWT.php public static $leeway = x; Where x are secunds, in my example or add difference of time in this if in from 123 :

if (isset($payload->iat) && $payload->iat > ($timestamp + static::$leeway +  
**720**)) {
    throw new BeforeValidException('Cannot handle token prior to ' . date(DateTime::ISO8601, $payload->iat)

But as I said... it's not safety...

Second solution is to set time on server in right way.

There is a lot of solutions how to do it: