0.2.0 • Published 4 years ago

spotify-login v0.2.0

Weekly downloads
3
License
MIT
Repository
github
Last release
4 years ago

Spotify Login - DEMO

npm version License: MIT Build Status Dependencies Language grade: 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:

<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:

<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:

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

Properties

PropertyAttributeDescriptionTypeDefault
clientIdclient-idClient ID for Spotify OAuth applicationstringundefined
redirectUriredirect-uriThe URI to redirect to after the user grants or denies permission.stringundefined
responseTyperesponse-typeScope for Spotify OAuth applicationstring"token"
scopescopeScope for Spotify OAuth applicationstringundefined
showDialogshow-dialogWhether or not to force the user to approve the app again if they’ve already done so.booleanundefined
statestateThe state can be useful for correlating requests and responsesstringundefined

Events

EventDescriptionType
completedCall with successCustomEvent<any>
failCall with errorCustomEvent<any>
requestCall with requestCustomEvent<any>

NPM Statistics

Download stats for this NPM package.

NPM

License

Spotify Login is open source software licensed as MIT.

0.2.0

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago