finally working google auth flow; do not delete!

This commit is contained in:
Henry Ault 2016-02-10 17:27:14 -08:00
parent 0e3a28ea5c
commit 6268b5f6aa
2 changed files with 12 additions and 7 deletions

View File

@ -24,6 +24,7 @@
++ grab-json
|* [a=httr b=fist:jo]
~| bad-json/r.a
~| (poja q:(need r.a))
(need (;~(biff poja b) q:(need r.a)))
--
::

View File

@ -22,21 +22,25 @@
response-type/%code
==
--
::
!:
::::
::
|_ [bal=(bale keys:oauth2) user-state]
++ auth-re ~(. (re:auth .) ref |=(a=_ref +>(ref a)))
++ auth ~(. (auth-usr usr.bal) bal (scopes 'userinfo.email' 'plus.me' ~))
++ auth ~(. (auth-usr usr.bal) bal ~&((scopes 'userinfo.email' 'plus.me' ~) (scopes 'userinfo.email' 'plus.me' ~)))
++ scopes
=+ scope=|=(b=@ta (endpoint:oauth2 dom.bal /auth/[b]))
|=(a=(list ,@ta) (turn a |=(b=@ta (crip (earn (scope b))))))
|=(a=(list ,@ta) ['https://mail.google.com' (turn a |=(b=@ta (crip (earn (scope b)))))])
::
++ out (out-fix-expired:auth-re (out-math:auth ber))
++ res (res-handle-refreshed:auth-re save-access res-give:auth)
++ res |=(a=httr ~&(a ((res-handle-refreshed:auth-re save-access res-give:auth) a)))
++ save-access |=(a=cord:[token:oauth2] +>(ber a))
::
++ in in-code:auth
++ bak (bak-save-tokens:auth-re save-access)
:: ++ upd *user-state
++ in
|= a=quay
~& got-quay/a
(in-code:auth a)
++ bak |=(a=httr ~&(bak/a ((bak-save-tokens:auth-re save-access) a)))
++ upd *user-state
--