Giter VIP home page Giter VIP logo

spotify-login's Introduction

Spotify Login - DEMO

npm versionLicense: MITBuild StatusDependenciesLanguage 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

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 Grant type the application wants to use string "token"
scope scope A space-delimited list of permissions that the application requires 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

License

Spotify Login is open source software licensed as MIT.

spotify-login's People

Contributors

andrelmlins avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.