# spotify-login

> Web Component for Spotify Login

Latest version **0.2.0** (published 2020-03-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install spotify-login
pnpm add spotify-login
yarn add spotify-login
bun add spotify-login
```

## Health

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

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

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2020-03-30 |
| First published | 2020-03-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 751.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6 |
| Author | André Lins |
| Maintainers | andrelmlins |
| Keywords | spotify, login, web-component |

## Links

- npm: https://www.npmjs.com/package/spotify-login
- Repository: https://github.com/andrelmlins/spotify-login
- Homepage: https://spotify-login.netlify.com/
- Issues: https://github.com/andrelmlins/spotify-login/issues
- npm.io page: https://npm.io/package/spotify-login

## Alternatives

- [cli-color](https://npm.io/package/cli-color.md) — 3.4M weekly downloads
- [log](https://npm.io/package/log.md) — 1.3M weekly downloads
- [logstash-client](https://npm.io/package/logstash-client.md) — 4.5K weekly downloads
- [@nocobase/plugin-logger](https://npm.io/package/@nocobase/plugin-logger.md) — 2.0K weekly downloads
- [child-process-debug](https://npm.io/package/child-process-debug.md) — 695 weekly downloads

## Recent versions

- 0.2.0 (latest) — 2020-03-30
- 0.1.2 — 2020-03-29
- 0.1.1 — 2020-03-29
- 0.1.0 — 2020-03-29

## README

# Spotify Login - [DEMO](https://spotify-login.netlify.com/)

[![npm version](https://badge.fury.io/js/spotify-login.svg)](https://www.npmjs.com/package/spotify-login) &bull; [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/andrelmlins/spotify-login/blob/master/LICENSE) &bull; [![Build Status](https://travis-ci.com/andrelmlins/spotify-login.svg?branch=master)](https://travis-ci.com/andrelmlins/spotify-login) &bull; [![Dependencies](https://david-dm.org/andrelmlins/spotify-login.svg)](https://david-dm.org/andrelmlins/spotify-login) &bull; [![Language grade: JavaScript](https://img.shields.io/lgtm/grade/javascript/g/andrelmlins/spotify-login.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/andrelmlins/spotify-login/context:javascript)

## How to install

It is possible to install with npm:

```
npm i spotify-login
// OR
yarn add spotify-login
```

Or import the script through the unpkg project:

```html
<script src="https://unpkg.com/spotify-login/dist/spotify-login.js"></script>
```

## How to usage

An example of how to use the webcomponent with html:

```html
<spotify-login
  client-id="XXX"
  scope="user-read-email"
  redirect-uri="http://localhost:8000"
>
  <button>Login with Spotify</button>
</spotify-login>

<script>
  const spotifyLoginElement = document.querySelector("spotify-login");

  spotifyLoginElement.addEventListener("completed", e => {
    console.log(e.details);
  });
  spotifyLoginElement.addEventListener("fail", e => {
    console.log(e);
  });
</script>
```

With JSX:

```jsx
<spotify-login onCompleted={e => console.log(e)} onError={e => console.log(e)}>
  <button>Login with Spotify</button>
</spotify-login>
```

## Properties

| Property       | Attribute       | Description                                                                           | Type      | Default     |
| -------------- | --------------- | ------------------------------------------------------------------------------------- | --------- | ----------- |
| `clientId`     | `client-id`     | Client ID for Spotify OAuth application                                               | `string`  | `undefined` |
| `redirectUri`  | `redirect-uri`  | The URI to redirect to after the user grants or denies permission.                    | `string`  | `undefined` |
| `responseType` | `response-type` | Scope for Spotify OAuth application                                                   | `string`  | `"token"`   |
| `scope`        | `scope`         | Scope for Spotify OAuth application                                                   | `string`  | `undefined` |
| `showDialog`   | `show-dialog`   | Whether or not to force the user to approve the app again if they’ve already done so. | `boolean` | `undefined` |
| `state`        | `state`         | The state can be useful for correlating requests and responses                        | `string`  | `undefined` |

## Events

| Event       | Description       | Type               |
| ----------- | ----------------- | ------------------ |
| `completed` | Call with success | `CustomEvent<any>` |
| `fail`      | Call with error   | `CustomEvent<any>` |
| `request`   | Call with request | `CustomEvent<any>` |

## NPM Statistics

Download stats for this NPM package.

[![NPM](https://nodei.co/npm/spotify-login.png)](https://nodei.co/npm/spotify-login/)

## License

Spotify Login is open source software [licensed as MIT](https://github.com/andrelmlins/spotify-login/blob/master/LICENSE).

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