open-index/open-npm huggingface dataset:
npm package: @stelligent/universal-google-sso
Description: This repository houses the source code for Stelligent's universal Google login workflow for the frontend of all our internal tools. It accomplishes two things:
Latest version: 1.0.0

# Stelligent Universal Google SSO

This repository houses the source code for Stelligent's universal Google login
workflow for the frontend of all our internal tools. It accomplishes two things:

1. Handles in-browser frontend authentication through Google
2. Deploys a tiny lambda that works with the frontend to return binary API keys

The goal is to have internal backends at Stelligent to work with binary API keys
and avoid including Google auth logic in every single backend.

The project is a react component.

## Getting Started (backend)

in your environment, define:

```bash
export BACKEND_APIKEY_SSM_PATH=<path to SSM String that contains the key>
```

in your terminal, execute:

```bash
npm run cdk deploy
```

## Getting Started (frontend)

in your terminal, execute:

```bash
npm i --save @stelligent/universal-google-sso
```

in your environment, define:

```bash
export REACT_APP_GOOGLE_CLIENT_ID=<your Google project client ID>.apps.googleusercontent.com
export REACT_APP_LOGIN_LAMBDA_URL=<https URL of the API Gateway front of the lambda>
```

in your React frontend:

```JSX
import React from 'react';
import StelligentLogin from '@stelligent/universal-google-sso'

export class MyCustomComponent extends React.Component {
  gotApiKey = key => {
    if (key) console.log(`Backend API key: ${key}`);
    else console.error('There was an error authenticating');
  }
  render() {
    return (<StelligentLogin onApiKey=${this.gotApiKey}>)
  }
}
```

## Publishing to NPM

make sure you are authenticated to NPM, then execute:

```bash
npm publish --access=public
```