urbit/sec/com/googleapis.hoon

53 lines
1.3 KiB
Plaintext
Raw Normal View History

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-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-04-07 23:07:21 +03:00
%+ add-query:interpolate 'https://accounts.google.com/o/oauth2/v2/auth'
%- 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
prompt+%consent
2016-01-16 02:30:15 +03:00
==
2016-01-27 04:44:14 +03:00
++ scopes
:~ '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
::
++ exchange-url 'https://www.googleapis.com/oauth2/v4/token'
--
!:
::::
::
|_ {bal/(bale keys:oauth2) own/user-state}
++ auth
=+ a=~(standard-refreshing oauth2 bal ber.own)
(a(state-usr &) ..auth ref.own |=(a/user-state ..auth(own a)))
::
++ out (out-refresh-or-add-header:auth exchange-url scopes dialog-url)
++ dialog-url (auth-usr usr.bal)
2016-02-17 05:21:45 +03:00
::
++ res res-save-after-refresh:auth
2016-01-27 04:44:14 +03:00
::
++ in (in-code-to-token:auth exchange-url)
++ bak bak-save-both-tokens:auth
:: ++ upd *user-state
--