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 +4 -4
- data/README.md +69 -2
- data/lib/omniauth-spotify.rb +1 -1
- data/lib/omniauth-spotify/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 92d94e3dcfcaa046bd396de8bb618c84f220878a
|
4
|
+
data.tar.gz: ab561fca5ffd6c811e9d50edbff5ee81e962b191
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|
|
data/lib/omniauth-spotify.rb
CHANGED