GitXplorerGitXplorer
m

omniauth-lastfm

public
13 stars
11 forks
4 issues

Commits

List of commits on branch master.
Unverified
1a7095b1e1e411fc3a8eabcda98a137fac562084

Relax rest-client dependency

kkrasnoukhov committed 11 years ago
Unverified
f2934f55083ce350418b10954d72e1d1b48a52a6

bump version

mmasterkain committed 12 years ago
Unverified
9bd731c1193aa64919c46cc66ac5d0c9e341ca89

gitignore

mmasterkain committed 12 years ago
Unverified
e6c7b12c0a8c0016af8298622fc494d67eaa968c

stop escaping values or last.fm won't redirect correctly

mmasterkain committed 12 years ago
Unverified
637f9f87789c41b5694fc73b96e38a824a7bd73f

bump version

mmasterkain committed 12 years ago
Unverified
2254bcd84377e62e6d192eddfd80382ea7885c59

Merge pull request #4 from ripuk/master

mmasterkain committed 12 years ago

README

The README file for this repository.

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.