sn-client-auth-google
This package contains a client-side Google Oauth2 authentication provider for sensenet ECM through sn-client-js
Installation with node and npm
To install the latest version run
npm install --save sn-client-js
Usage
Prerequisites
- sensenet ECM 7.0 with an installed Google OAuth provider
- Google API Console project
- (optional) Google Platform Library or another Google OAuth component that can retrieve id_token
Setup
You can set up the Provider after creating your repository singleton with the AddGoogleAuth method
; ; AddGoogleAuthmyRepository, ;
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 LoginidToken?: string