omniauth-spotify 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3f5ba67667a661c8021303011a181ce6f6e799ce
4
- data.tar.gz: ebdb8f5e32baacb6adda30dde560f0bb062ac67e
3
+ metadata.gz: 92d94e3dcfcaa046bd396de8bb618c84f220878a
4
+ data.tar.gz: ab561fca5ffd6c811e9d50edbff5ee81e962b191
5
5
  SHA512:
6
- metadata.gz: 41cec089dc3c39752949b71166adf332f2760e8dbb1ffc15fc70c919d2a06c5aa75c9c872b1041e765412ef8cc2a4d72c1647474e9bb1a94cc369072bc097562
7
- data.tar.gz: 67782f6a37093b1f0d348f533aaf5a405160fd0ed110890b2f0f4b4021c0250cd319a736df67cec6ede4a376a2bb165dd9e1826d9e73c06ed7b4722b4081dc40
6
+ metadata.gz: 40c9be788793aec824631bf5aa291e9a9a42966f3aa9809bb3795dff958cb9e2694e2becd110f9f09bfefa48cd6aa3e9a72d04447b0913ba1f1f73248ebf5515
7
+ data.tar.gz: aaf6ffdfbd199142ffcfcf9c941cbc7fd23a9ffd077b6a85c9df7b19af4a4966d4be2c8acb000c429c84156b2ea1e6f8c9e53b3a8a545118f3b3539384d6b254
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Spotify OmniAuth Strategy
2
2
 
3
- This gem provides a simple way to authenticate to Spotify using OmniAuth with OAuth2.
3
+ This gem provides a simple way to authenticate to Spotify Web API using OmniAuth with OAuth2.
4
4
 
5
5
  ## Installation
6
6
 
@@ -18,7 +18,74 @@ Or install it yourself as:
18
18
 
19
19
  ## Usage
20
20
 
21
- TODO: Write usage instructions here
21
+ You'll need to register an app on Spotify, you can do this here - https://developer.spotify.com/my-applications/#!/
22
+
23
+ Usage of the gem is very similar to other OmniAuth strategies.
24
+ You'll need to add your app credentials to `config/initializers/omniauth.rb`:
25
+
26
+ ```ruby
27
+ Rails.application.config.middleware.use OmniAuth::Builder do
28
+ provider :spotify, 'app_id', 'app_secret', scope: 'playlist-read-private user-read-private user-read-email'
29
+ end
30
+ ```
31
+
32
+ Please replace the example `scope` provided with your own.
33
+ Read more about scopes here: https://developer.spotify.com/web-api/using-scopes/
34
+
35
+ Or with Devise in `config/initializers/devise.rb`:
36
+
37
+ ```ruby
38
+ config.omniauth :spotify, 'app_id', 'app_secret', scope: 'playlist-read-private user-read-private user-read-email'
39
+ ```
40
+
41
+ ## Auth Hash Schema
42
+
43
+ Here's an example auth hash, available in `request.env['omniauth.auth']`:
44
+
45
+ ```ruby
46
+ {
47
+ :provider => "spotify",
48
+ :uid => "1111111111",
49
+ :info => {
50
+ :name => nil,
51
+ :email => "claudio@icorete.ch"
52
+ },
53
+ :credentials => {
54
+ :token => "xxxx",
55
+ :refresh_token => "xxxx",
56
+ :expires_at => 1403021232,
57
+ :expires => true
58
+ },
59
+ :extra => {
60
+ :raw_info => {
61
+ :country => "IT",
62
+ :display_name => "Claudio Poli",
63
+ :email => "claudio@icorete.ch",
64
+ :external_urls => {
65
+ :spotify => "https://open.spotify.com/user/1111111111"
66
+ },
67
+ :href => "https://api.spotify.com/v1/users/1111111111",
68
+ :id => "1111111111",
69
+ :images => [
70
+ {
71
+ "height" => nil,
72
+ "url" => "https://fbcdn-profile-a.akamaihd.net/hprofile-ak-xfp1/t1.0-1/s320x320/301234_1962753760624_625151598_n.jpg",
73
+ "width" => nil
74
+ }
75
+ ],
76
+ :product => "open",
77
+ :type => "user",
78
+ :uri => "spotify:user:1111111111"
79
+ }
80
+ }
81
+ }
82
+
83
+ ```
84
+
85
+ ## More
86
+
87
+ This gem is brought to you by the [AudioBox](https://audiobox.fm) guys.
88
+ Enjoy!
22
89
 
23
90
  ## Contributing
24
91
 
@@ -23,7 +23,7 @@ module OmniAuth
23
23
 
24
24
  info do
25
25
  {
26
- :name => raw_info['name'],
26
+ :name => raw_info['display_name'],
27
27
  :email => raw_info['email']
28
28
  }
29
29
  end
@@ -1,5 +1,5 @@
1
1
  module Omniauth
2
2
  module Spotify
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-spotify
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Claudio Poli