/
userinfo.clj
63 lines (55 loc) · 1.62 KB
/
userinfo.clj
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
(ns happygapi.oauth2.userinfo
"Google OAuth2 API: userinfo.
Obtains end-user authorization grants for use with other Google APIs.
See: https://developers.google.com/accounts/docs/OAuth2api/reference/rest/v2/userinfo"
(:require [cheshire.core :as json]
[clj-http.client :as http]
[happy.util :as util]))
(defn get$
"https://developers.google.com/accounts/docs/OAuth2api/reference/rest/v2/userinfo/get
Required parameters: none
Optional parameters: none
"
{:scopes ["openid"
"https://www.googleapis.com/auth/userinfo.email"
"https://www.googleapis.com/auth/userinfo.profile"]}
[auth parameters]
{:pre [(util/has-keys? parameters #{})]}
(util/get-response
(http/get
(util/get-url
"https://www.googleapis.com/"
"oauth2/v2/userinfo"
#{}
parameters)
(merge-with
merge
{:throw-exceptions false,
:query-params parameters,
:accept :json,
:as :json}
auth))))
(defn v2-me-get$
"https://developers.google.com/accounts/docs/OAuth2api/reference/rest/v2/userinfo/v2/me/get
Required parameters: none
Optional parameters: none
"
{:scopes ["openid"
"https://www.googleapis.com/auth/userinfo.email"
"https://www.googleapis.com/auth/userinfo.profile"]}
[auth parameters]
{:pre [(util/has-keys? parameters #{})]}
(util/get-response
(http/get
(util/get-url
"https://www.googleapis.com/"
"userinfo/v2/me"
#{}
parameters)
(merge-with
merge
{:throw-exceptions false,
:query-params parameters,
:accept :json,
:as :json}
auth))))