@@ -8,29 +8,29 @@ class Snapchat < OmniAuth::Strategies::OAuth2
8
8
option :name , "snapchat"
9
9
10
10
option :client_options , {
11
- : site => ' https://adsapi.snapchat.com' ,
12
- : authorize_url => ' https://accounts.snapchat.com/login/oauth2/authorize' ,
13
- : token_url => ' https://accounts.snapchat.com/accounts/oauth2/token'
11
+ site : " https://adsapi.snapchat.com" ,
12
+ authorize_url : " https://accounts.snapchat.com/login/oauth2/authorize" ,
13
+ token_url : " https://accounts.snapchat.com/accounts/oauth2/token"
14
14
}
15
15
16
- uid { raw_info [ 'me' ] [ ' externalId' ] }
16
+ uid { raw_info [ "me" ] [ " externalId" ] }
17
17
18
18
info do
19
19
{
20
- name : raw_info [ 'me' ] [ ' displayName' ] ,
21
- image : raw_info [ 'me' ] [ ' bitmoji' ] [ ' avatar' ]
20
+ name : raw_info [ "me" ] [ " displayName" ] ,
21
+ image : raw_info [ "me" ] [ " bitmoji" ] [ " avatar" ]
22
22
}
23
23
end
24
24
25
25
extra do
26
26
{
27
- ' raw_info' => raw_info
27
+ " raw_info" => raw_info
28
28
}
29
29
end
30
30
31
+ # After back and forth with snapchat support team, using the GraphQL
32
+ # endpoint seems the easiest.
31
33
def raw_info
32
- # After back and forth with snapchat support team, using the GraphQL
33
- # endpoint seems the easiest.
34
34
raw_info_url = "https://kit.snapchat.com/v1/me?query=%7Bme%7BexternalId%2C+displayName%2C+bitmoji%7Bavatar%7D%7D%7D"
35
35
@raw_info ||= access_token . get ( raw_info_url ) . parsed [ "data" ]
36
36
end
@@ -42,10 +42,10 @@ def callback_url
42
42
def token_params
43
43
authorization = Base64 . strict_encode64 ( "#{ options . client_id } :#{ options . client_secret } " )
44
44
super . merge ( {
45
- headers : {
46
- ' Authorization' => "Basic #{ authorization } "
47
- }
48
- } )
45
+ headers : {
46
+ " Authorization" => "Basic #{ authorization } "
47
+ }
48
+ } )
49
49
end
50
50
end
51
51
end
0 commit comments