Core Boxx – Login With Google

TABLE OF CONTENTS

 

DOWNLOAD & INSTALLATION

First, the download links for the module, and also “installation instructions”.

 

LICENSE & DOWNLOAD

GitHubSource Forge

Core Boxx is released under the MIT License. You are free to use it for personal and commercial projects, and modify it as you see fit. On the condition that the software is provided “as-is”. There are no warranties provided and “no strings attached”. Code Boxx and the authors are not liable for any claims, damages, or liabilities.

 

 

REGISTER WITH GOOGLE

  • Head over to Google API Console
  • Create a new project, or select an existing project.
  • Next, go under “OAuth consent screen”.
    • Fill in your app info.
    • Scopes can be left blank.
    • Under “Test Users”, add your own Gmail account.
    • Leave the app as “testing”, do not publish until you are ready.
  • Finally, go under “Credentials”.
    • Create credentials > OAuth client ID.
    • Set the name of your app, set your origin – http://your-site.com.
    • Set redirect URL as http://your-site.com/login.
    • After completion, Google will give you the client ID and secret. Download and save the credentials as lib/CRD-Google.json.

 

INSTALLATION

  • Install the Users Module first.
  • Copy/unzip this module into your existing Core Boxx project folder.
  • Access http://your-site.com/install/GOOIN, this will automatically:
    • Add “login with Google” button to pages/PAGE-login.php.
    • Add “sign up with Google” button to pages/PAGE-register.php.
    • Delete PAGE-install-GOOIN.php itself.

 

SORRY FOR THE ADS...

But someone has to pay the bills, and sponsors are paying for it. I insist on not turning Code Boxx into a "paid scripts" business, and I don't "block people with Adblock". Every little bit of support helps.

Buy Me A Coffee Code Boxx eBooks

 

FILES LIST

LIBRARIES

ASSETS & PAGES

  • pages/MAIL-gooin.php For new users only – Send automatically generated password to user on Google Login.

 

 

LIBRARY REFERENCE

Lastly, the list of library functions and API endpoints.

 

construct ()

Automatically creates a new Google Client object.

in ()

Creates a “Login With Google” link.

<a href="<?=$_CORE->GOOIN->in()?>">Login With Google</a>
go ()

Process login.

if (isset($_GET["code"])) { $_CORE->GOOIN->go(); }
get ($id)

Get the user with the given Google ID.

$user = $_CORE->GOOIN->get(12345678901234567890);
login ($user)

Login and set the given user in $_SESSION. Helper function for go().

$user = $_CORE->GOOIN->get(12345678901234567890);
$_CORE->GOOIN->login($user);

Leave a Comment

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