# aws-federated-login

> Amazon Federated Login Client

Latest version **1.1.19** (published 2023-01-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install aws-federated-login
pnpm add aws-federated-login
yarn add aws-federated-login
bun add aws-federated-login
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.19 |
| Published | 2023-01-10 |
| First published | 2022-11-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 7.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | taoyingsong |
| Maintainers | yingsongtys |
| Keywords | aws, login, federated, amazon |

## Links

- npm: https://www.npmjs.com/package/aws-federated-login
- Repository: https://github.com/taoyingsong/aws-federated-login
- Homepage: https://github.com/taoyingsong/aws-federated-login#readme
- Issues: https://github.com/taoyingsong/aws-federated-login/issues
- npm.io page: https://npm.io/package/aws-federated-login

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 1.1.19 (latest) — 2023-01-10
- 1.1.18 — 2023-01-10
- 1.1.17 — 2022-11-23
- 1.1.16 — 2022-11-22
- 1.1.15 — 2022-11-22
- 1.1.14 — 2022-11-15
- 1.1.13 — 2022-11-15
- 1.1.12 — 2022-11-15
- 1.1.11 — 2022-11-11
- 1.1.10 — 2022-11-11
- 1.1.9 — 2022-11-11
- 1.1.8 — 2022-11-11
- 1.1.7 — 2022-11-11
- 1.1.6 — 2022-11-03
- 1.1.5 — 2022-11-03
- … 7 more at https://npm.io/package/aws-federated-login/versions

## README

# aws-federated-login

Amazon Federated Login Client

# Installation

```
npm i aws-federated-login
```

# Introduction

With this package you can choose between popup and redirection during federated login via AWS

# API:

## 1. awsFederatedLogin

trigger popup function
[Detailed meaning of fields](https://docs.aws.amazon.com/cognito/latest/developerguide/authorization-endpoint.html)

```js
interface LoginParams {
    awsAuthorizedUrl: string;
    client_id: string;
    identity_provider: string;
    redirect_uri: string;
    response_type: string;
    scope: string;
    mode?: 'popup' | 'redirect'; // default 'redirect'
    callback: (params: any) => void;
}
export declare const awsFederatedLogin: (loginParams: LoginParams) => void;
```

## 2. awsRedirect:

popup middle page send message to the callback function that triggers the popup function

```js
export declare const awsRedirect: () => void;
```

# Demo

```js
// trigger popup page
import { awsFederatedLogin } from 'aws-federated-login'
<button
    onClick={() => {
        awsFederatedLogin({
            awsAuthorizedUrl: 'https://XXX.amazoncognito.com/oauth2/authorize',
            client_id: 'XXX',
            identity_provider: 'Google', // 'Google' 'Facebook'
            redirect_uri: 'http://localhost:3000/pages/callback.html',
            response_type: 'CODE',
            scope: 'email openid phone',
            mode: 'popup',
            callback: (response) => {
                console.log('response is:', response)
            }
        })
    }
>
</button>

```

```js
// callback.html
import { awsFederatedLogin } from 'aws-federated-login'
awsRedirect()
```

---
_Source: https://npm.io/package/aws-federated-login · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
