Git Product home page Git Product logo

omniauth-lastfm's Introduction

OmniAuth Last.fm

Last.fm strategy for OmniAuth 1.0.

Installing

Add to your Gemfile:

gem 'omniauth'
gem 'omniauth-lastfm'

Then bundle install.

Usage

You'll need an API account with Last.fm, you can get one here - http://www.last.fm/api.

Usage of the gem is very similar to other OmniAuth 1.0 strategies. You'll need to add your API keys to config/initializers/omniauth.rb:

Rails.application.config.middleware.use OmniAuth::Builder do
  provider :lastfm, "consumer_key", "consumer_secret"
end

Now simply follow the README at: https://github.com/intridea/omniauth.

Auth Hash Schema

Here's an example auth hash, available in request.env['omniauth.auth']:

{
   "provider": "lastfm",
   "uid": "ripuk",
   "info": {
      "nickname": "ripuk",
      "name": "David Stephens",
      "url": "http://www.last.fm/user/ripuk",
      "image": "http://userserve-ak.last.fm/serve/252/46787679.jpg",
      "country": "UK",
      "age": "31",
      "gender": "m"
   },
   "credentials": {
      "token": "abcdefghijklmnop",
      "name": "ripuk"
   },
   "extra": {
      "raw_info": {
         "name": "ripuk",
         "realname": "David Stephens",
         "image": [
            {
               "#text": "http://userserve-ak.last.fm/serve/34/46787679.jpg",
               "size": "small"
            },
            {
               "#text": "http://userserve-ak.last.fm/serve/64/46787679.jpg",
               "size": "medium"
            },
            {
               "#text": "http://userserve-ak.last.fm/serve/126/46787679.jpg",
               "size": "large"
            },
            {
               "#text": "http://userserve-ak.last.fm/serve/252/46787679.jpg",
               "size": "extralarge"
            }
         ],
         "url": "http://www.last.fm/user/ripuk",
         "id": "25400308",
         "country": "UK",
         "age": "31",
         "gender": "m",
         "subscriber": "0",
         "playcount": "11530",
         "playlists": "0",
         "bootstrap": "0",
         "registered": {
            "#text": "2009-12-30 00:53",
            "unixtime": "1262134389"
         },
         "type": "user"
      }
   }
}

What Next?

The Rockstar Gem is a great way to make use of the auth token retrieved with this gem.

omniauth-lastfm's People

Contributors

masterkain avatar davestephens avatar arekk avatar krasnoukhov avatar rdsoze avatar

Watchers

Bruno Michel avatar Arnaud Berthomier avatar anicet avatar Luc-pascal Ceccaldi avatar Florent Peyraud avatar Dominique Rose-Rosette avatar Xinhui Xu avatar klacointe avatar Ori Pekelman avatar Maxim Bénadon avatar Johan Van Ryseghem avatar  avatar Kévin Le Roy avatar  avatar James Cloos avatar Rouffi avatar Thomas avatar Jenkins @ af83 avatar  avatar  avatar  avatar Victor Deschamps de Paillette avatar Kevin Bonnin avatar Marie avatar  avatar Marion de Chamisso avatar  avatar Leotrouvtou avatar Guillaume avatar  avatar  avatar Aurelien Grmd avatar  avatar  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.