151ify, elaborate facebook and slack drivers

This commit is contained in:
Anton Dyudin 2016-03-04 12:33:01 -08:00
parent 886890d1f8
commit b4f2a6d24b
2 changed files with 8 additions and 6 deletions

View File

@ -8,15 +8,17 @@
::
=+ [`/com/facebook/www /dialog/oauth response-type/%code ~]
=+ aut=(oauth2 - /'v2.3'/oauth/'access_token')
|_ [bal=(bale keys.aut) access-token=token.aut]
|_ {bal/(bale keys.aut) access-token/token.aut}
++ auth ~(. aut bal /'user_about_me'/'user_posts')
++ out (out-quay:auth 'access_token'^access-token)
++ out (out-quay:auth key='access_token' value=access-token)
++ in in-code:auth
++ bak
%- (bak-parse:auth . access-token.aut expires-in.aut ~)
|= [access-token=@t expires-in=@u]
|= {access-token/@t expires-in/@u}
?: (lth expires-in ^~((div ~d7 ~s1))) :: short-lived token
(toke-req:auth 'fb_exchange_token' fb-exchange-token/access-token ~)
%^ toke-req:auth grant-type='fb_exchange_token'
[key='fb_exchange_token' value=access-token]
~
[[%redo ~] ..bak(access-token access-token)]
::++ wyp ~
--

View File

@ -7,9 +7,9 @@
::::
::
=+ aut=(oauth2 [`/com/slack /oauth/authorize ~] /api/'oauth.access')
|_ [(bale keys:oauth2) tok=token.aut]
|_ {(bale keys:oauth2) tok/token.aut}
++ aut ~(. ^aut +<- /client/admin)
++ out (out-quay:aut 'token'^tok)
++ in in-code:aut
++ bak (bak-save-access:aut . |=(tok=token:aut +>(tok tok)))
++ bak (bak-save-access:aut . |=(tok/token:aut +>(tok tok)))
--