JSPM

  • Created
  • Published
  • Downloads 150725
  • Score
    100M100P100Q32734F
  • License MIT

A Component React for Google Login

Package Exports

  • react-google-login

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-google-login) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

React Google Login

An Component React for Google Login

How to use

'use strict';

import React from 'react';
import ReactDOM from 'react-dom';
import GoogleLogin from 'react-google-login';

const responseGoogle = (response) => {
  console.log(response);
}

ReactDOM.render(
  <GoogleLogin
    clientId="1088597931155576"
    buttonText="Login"
    callback={responseGoogle} />,
  document.getElementById('googleButton')
);

Callback

If offline is false callback will return the currentUser object.

If offline is true callback will return the offline token for use on your server.

Parameters

params value default value
clientId string REQUIRED
scope string profile email
callback function REQUIRED
offline boolean false
buttonText string Login with Google
cssClass string -
redirectUri string postmessage

Test Server

npm run start

Production Bundle

npm run bundle
Modeled after @keppelen React Facebook Login

Follow me on Twitter: @anthonyjgrove