2.1.3 • Published 2 years ago

@sensenet/authentication-google v2.1.3

Weekly downloads
33
License
GPL-2.0
Repository
github
Last release
2 years ago

@sensenet/authentication-google

This package contains a client-side Google Oauth2 authentication provider for sensenet.

NPM version NPM downloads License: GPL v2

Install

# Yarn
yarn add @sensenet/authentication-google

# NPM
npm install @sensenet/authentication-google

Usage

Prerequisites

Setup

You can set up the Provider after creating your repository singleton with the addGoogleAuth method

import { Repository } from '@sensenet/client-core'
import { JwtService } from '@sensenet/authentication-jwt'
import { addGoogleAuth } from '@sensenet/authentication-google'

const repo = new Repository()
const jwt = new JwtService(repo)
const googleOauthProvider = addGoogleAuth(jwt, { clientId: '' })

Login

In your login component, you can use the following snippet. If you don't provide an id_token from an external component, the package will try to retrieve it using a popup window (in that case you have to enable popups and add a callback pointing to your window's origin)

// an example login method with an optional idToken:
async Login(idToken?: string){
 try {
     await googleOauthProvider.login(idToken);
     console.log('Logged in');
 } catch (error) {
    console.warn('Error during login', error);
 }
}
2.1.3

2 years ago

2.1.2

3 years ago

2.1.1

3 years ago

2.1.0

3 years ago

2.0.32

3 years ago

2.0.31

3 years ago

2.0.30

3 years ago

2.0.29

3 years ago

2.0.28

3 years ago

2.0.26

4 years ago

2.0.25

4 years ago

2.0.24

4 years ago

2.0.23

4 years ago

2.0.22

4 years ago

2.0.21

4 years ago

2.0.20

4 years ago

2.0.19

4 years ago

2.0.18

4 years ago

2.0.17

4 years ago

2.0.16

4 years ago

2.0.15

4 years ago

2.0.14

4 years ago

2.0.13

5 years ago

2.0.12

5 years ago

2.0.11

5 years ago

2.0.10

5 years ago

2.0.9

5 years ago

2.0.8

5 years ago

2.0.7

5 years ago

2.0.6

5 years ago

2.0.4

5 years ago

2.0.3

5 years ago

2.0.2

5 years ago

2.0.2-alpha.0

5 years ago

2.0.1

6 years ago

2.0.0

6 years ago