2016-03-04 23:27:54 +03:00
|
|
|
:: Test url +https://www.googleapis.com/oauth2/v1/userinfo
|
|
|
|
::
|
2016-03-05 03:24:23 +03:00
|
|
|
:::: /hoon/googleapis/com/sec
|
2016-03-04 23:27:54 +03:00
|
|
|
::
|
2016-04-07 23:07:21 +03:00
|
|
|
/+ oauth2, interpolate, hep-to-cab
|
2016-01-20 00:55:51 +03:00
|
|
|
::
|
|
|
|
::::
|
|
|
|
::
|
|
|
|
|%
|
2016-02-19 23:33:56 +03:00
|
|
|
++ user-state {ber/token ref/refresh}:oauth2
|
2016-01-28 00:58:28 +03:00
|
|
|
++ suffix-email
|
|
|
|
%+ cook welp
|
|
|
|
;~ plug
|
|
|
|
(star ;~(less pat prn))
|
|
|
|
;~(pose (plus prn) (easy "@gmail.com"))
|
|
|
|
==
|
|
|
|
::
|
|
|
|
++ auth-usr
|
2017-10-21 02:53:34 +03:00
|
|
|
|= usr/user:eyre
|
2016-01-28 00:58:28 +03:00
|
|
|
=+ lon=(fall (slaw %t usr) usr)
|
2016-04-07 23:07:21 +03:00
|
|
|
%+ add-query:interpolate 'https://accounts.google.com/o/oauth2/v2/auth'
|
2016-04-08 03:46:48 +03:00
|
|
|
%- quay:hep-to-cab
|
2016-04-07 23:07:21 +03:00
|
|
|
:~ login-hint+?~(lon '' (crip (rash lon suffix-email)))
|
|
|
|
access-type+%offline
|
|
|
|
response-type+%code
|
2017-10-21 02:53:34 +03:00
|
|
|
prompt+%consent
|
2016-01-16 02:30:15 +03:00
|
|
|
==
|
2016-01-27 04:44:14 +03:00
|
|
|
++ scopes
|
2016-03-05 00:09:59 +03:00
|
|
|
:~ 'https://mail.google.com'
|
|
|
|
'https://www.googleapis.com/auth/plus.me'
|
|
|
|
'https://www.googleapis.com/auth/userinfo.email'
|
2018-05-07 19:52:59 +03:00
|
|
|
'https://www.googleapis.com/auth/ndev.clouddns.readwrite'
|
2018-06-16 05:45:21 +03:00
|
|
|
'https://www.googleapis.com/auth/cloud-platform.read-only'
|
2016-03-05 00:09:59 +03:00
|
|
|
==
|
2016-01-27 04:44:14 +03:00
|
|
|
::
|
2016-04-08 03:46:48 +03:00
|
|
|
++ exchange-url 'https://www.googleapis.com/oauth2/v4/token'
|
|
|
|
--
|
2016-11-17 04:42:58 +03:00
|
|
|
::
|
2016-04-08 03:46:48 +03:00
|
|
|
::::
|
|
|
|
::
|
2017-10-21 02:53:34 +03:00
|
|
|
|_ {bal/(bale:eyre keys:oauth2) own/user-state}
|
2016-04-08 23:27:53 +03:00
|
|
|
:: ++auth is a "standard refreshing oauth2" core, which implements the
|
|
|
|
:: most common handling of oauth2 semantics. see lib/oauth2 for more details,
|
|
|
|
:: and examples at the bottom of the file.
|
2016-04-08 03:46:48 +03:00
|
|
|
++ auth
|
|
|
|
=+ a=~(standard-refreshing oauth2 bal ber.own)
|
|
|
|
(a(state-usr &) ..auth ref.own |=(a/user-state ..auth(own a)))
|
|
|
|
::
|
2016-04-13 01:12:51 +03:00
|
|
|
++ filter-request (out-refresh-or-add-header:auth exchange-url scopes dialog-url)
|
2016-04-08 03:46:48 +03:00
|
|
|
++ dialog-url (auth-usr usr.bal)
|
2016-02-17 05:21:45 +03:00
|
|
|
::
|
2016-04-13 01:12:51 +03:00
|
|
|
++ filter-response res-save-after-refresh:auth
|
2016-01-27 04:44:14 +03:00
|
|
|
::
|
2016-04-13 01:12:51 +03:00
|
|
|
++ receive-auth-query-string (in-code-to-token:auth exchange-url)
|
|
|
|
++ receive-auth-response bak-save-both-tokens:auth
|
|
|
|
:: ++ update *user-state
|
2016-01-20 00:55:51 +03:00
|
|
|
--
|