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-01-27 04:44:14 +03:00
|
|
|
/+ oauth2
|
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
|
2016-02-19 23:33:56 +03:00
|
|
|
|= usr/iden
|
2016-01-28 00:58:28 +03:00
|
|
|
=+ lon=(fall (slaw %t usr) usr)
|
2016-01-27 04:44:14 +03:00
|
|
|
=< .(state-usr &)
|
|
|
|
%- oauth2
|
2016-03-04 23:35:56 +03:00
|
|
|
:_ exchange='https://www.googleapis.com/oauth2/v4/token'
|
|
|
|
^= dialog
|
|
|
|
%* . (need (epur 'https://accounts.google.com/o/oauth2/v2/auth'))
|
|
|
|
r
|
|
|
|
%- fass:oauth2
|
|
|
|
:~ login-hint+?~(lon '' (crip (rash lon suffix-email)))
|
|
|
|
access-type+%offline
|
|
|
|
response-type+%code
|
|
|
|
prompt+%consent
|
|
|
|
==
|
2016-01-16 02:30:15 +03:00
|
|
|
==
|
|
|
|
--
|
2016-02-11 04:27:14 +03:00
|
|
|
!:
|
2016-01-16 02:30:15 +03:00
|
|
|
::::
|
|
|
|
::
|
2016-02-19 23:33:56 +03:00
|
|
|
|_ {bal/(bale keys:oauth2) user-state}
|
|
|
|
++ auth-re ~(. (re:auth .) ref |=(a/_ref +>(ref a)))
|
2016-03-05 00:09:59 +03:00
|
|
|
++ auth ~(. (auth-usr usr.bal) bal scopes)
|
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'
|
|
|
|
==
|
2016-01-27 04:44:14 +03:00
|
|
|
::
|
|
|
|
++ out (out-fix-expired:auth-re (out-math:auth ber))
|
2016-02-19 23:33:56 +03:00
|
|
|
++ res |=(a/httr ((res-handle-refreshed:auth-re save-access res-give:auth) a))
|
2016-02-17 05:21:45 +03:00
|
|
|
::
|
2016-02-19 23:33:56 +03:00
|
|
|
++ save-access |=(a/cord:[token:oauth2] +>(ber a))
|
2016-01-27 04:44:14 +03:00
|
|
|
::
|
2016-02-11 04:27:14 +03:00
|
|
|
++ in
|
2016-02-19 23:33:56 +03:00
|
|
|
|= a/quay
|
2016-02-11 04:27:14 +03:00
|
|
|
(in-code:auth a)
|
2016-02-19 23:33:56 +03:00
|
|
|
++ bak |=(a/httr ((bak-save-tokens:auth-re save-access) a))
|
2016-02-24 06:49:17 +03:00
|
|
|
++ upd *user-state
|
2016-01-20 00:55:51 +03:00
|
|
|
--
|