omniauth-seznam-cz 0.1.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +26 -16
- data/lib/omniauth/seznam_cz/version.rb +1 -1
- data/lib/omniauth/strategies/seznam_cz.rb +9 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b50b0a245cbaf3a116526977f608e7f16fa340e3ae773a808df284d6af2371f3
|
4
|
+
data.tar.gz: 0ed84fd322352e4475007cf95f89ef4cc2c8893b28d357f4ed580103a7da8dac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 88ea2c7a4697174ea6efcf6455ece58f1021eb7f843753d3dd2b258ff7c59d3745009ef3700d0d2fe762b90e1658b376fdffccd3c7cea8bbdc4a56b2557718b6
|
7
|
+
data.tar.gz: f34371a3666f9ea950f80b43e7841304d25850181d50054290fc97bd938466c2948bf7ed4f7bf71eb743f214df36511c6efb2a07bba77b05ad0ad579651f0bd7
|
data/README.md
CHANGED
@@ -47,23 +47,33 @@ Here's an example of an authentication hash available in the callback by accessi
|
|
47
47
|
|
48
48
|
```ruby
|
49
49
|
{
|
50
|
-
"provider"
|
51
|
-
"uid"
|
52
|
-
"info"
|
53
|
-
"name"
|
54
|
-
"email"
|
55
|
-
"
|
56
|
-
"
|
57
|
-
"
|
58
|
-
"
|
59
|
-
|
60
|
-
|
50
|
+
"provider": "seznam_cz",
|
51
|
+
"uid": "100000000000000000000",
|
52
|
+
"info": {
|
53
|
+
"name": "Jan Sterba",
|
54
|
+
"email": "jan.sterba@seznam.cz",
|
55
|
+
"firstname": "Jan",
|
56
|
+
"lastname": "Sterba",
|
57
|
+
"contact_phone": null,
|
58
|
+
"avatar_url": null
|
59
|
+
},
|
60
|
+
"credentials": {
|
61
|
+
"token": "TOKEN",
|
62
|
+
"refresh_token": "REFRESH_TOKEN",
|
63
|
+
"expires_at": 1672768905,
|
64
|
+
"expires": true
|
61
65
|
},
|
62
|
-
"
|
63
|
-
"
|
64
|
-
|
65
|
-
|
66
|
-
|
66
|
+
"extra": {
|
67
|
+
"raw_info": {
|
68
|
+
"advert_user_id": "100000000000000000000",
|
69
|
+
"domain": "seznam.cz",
|
70
|
+
"firstname": "Jan",
|
71
|
+
"lastname": "Sterba",
|
72
|
+
"message": "ok",
|
73
|
+
"oauth_user_id": "100000000000000000001",
|
74
|
+
"status": 200,
|
75
|
+
"username": "jan.sterba"
|
76
|
+
}
|
67
77
|
}
|
68
78
|
}
|
69
79
|
```
|
@@ -6,6 +6,7 @@ require 'uri'
|
|
6
6
|
|
7
7
|
module OmniAuth
|
8
8
|
module Strategies
|
9
|
+
# Main class for Seznam.cz strategy.
|
9
10
|
class SeznamCz < OmniAuth::Strategies::OAuth2
|
10
11
|
ALLOWED_ISSUERS = ['login.szn.cz'].freeze
|
11
12
|
BASE_SCOPES = %w[identity contact-phone avatar].freeze
|
@@ -34,14 +35,14 @@ module OmniAuth
|
|
34
35
|
end
|
35
36
|
end
|
36
37
|
|
37
|
-
uid { raw_info['
|
38
|
+
uid { raw_info['oauth_user_id'] }
|
38
39
|
|
39
40
|
info do
|
40
41
|
{
|
41
|
-
|
42
|
-
email: raw_info['username'],
|
43
|
-
domain: raw_info['domain'],
|
42
|
+
name: "#{raw_info['firstname']} #{raw_info['lastname']}",
|
43
|
+
email: "#{raw_info['username']}@#{raw_info['domain']}",
|
44
44
|
firstname: raw_info['firstname'],
|
45
|
+
lastname: raw_info['lastname'],
|
45
46
|
contact_phone: raw_info['contact-phone'],
|
46
47
|
avatar_url: raw_info['avatar-url']
|
47
48
|
}
|
@@ -51,6 +52,10 @@ module OmniAuth
|
|
51
52
|
{ 'raw_info' => raw_info }
|
52
53
|
end
|
53
54
|
|
55
|
+
def callback_url
|
56
|
+
full_host + callback_path
|
57
|
+
end
|
58
|
+
|
54
59
|
def raw_info
|
55
60
|
@raw_info ||= access_token.get(USER_INFO_URL).parsed
|
56
61
|
end
|