shrub/sec/com/dropboxapi.hoon

42 lines
1.4 KiB
Plaintext
Raw Normal View History

2016-04-08 04:39:48 +03:00
:: Test url +https://api.dropboxapi.com/2/users/get_current_account &json ~
2016-04-07 02:42:38 +03:00
::
:::: /hoon/dropboxapi/com/sec
::
/+ oauth2
::
::::
::
2016-04-08 04:39:48 +03:00
|%
++ dialog-url 'https://www.dropbox.com/1/oauth2/authorize?response_type=code'
++ exchange-url 'https://api.dropboxapi.com/1/oauth2/token'
--
2016-04-08 04:39:48 +03:00
::
::::
::
|_ {bal/(bale keys:oauth2) tok/token:oauth2}
:: ++aut is a "standard 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 04:39:48 +03:00
++ aut (~(standard oauth2 bal tok) . |=(tok/token:oauth2 +>(tok tok)))
++ filter-request (out-add-header:aut scope=~ dialog-url)
2016-04-08 04:39:48 +03:00
::
++ receive-auth-query-string (in-code-to-token:aut exchange-url)
++ receive-auth-response bak-save-token:aut
--
2016-04-08 05:09:32 +03:00
:: create a developer app on https://www.dropbox.com/developers-v1/apps to get a
:: client id and secret.
:: Be sure to be on https://localhost:8443 and to have registered
:: 'http://localhost:8443/~/ac/dropboxapi.com/~./in' as the redirect URI.
:: (If unable to change port number of ship, change the redirect URI port in %eyre)
:: |init-oauth2 |init-oauth2 /com/dropbox
2016-04-08 05:09:32 +03:00
:: Enter this sample command to show your user info:
:: +https://api.dropboxapi.com/2/users/get_current_account &json ~
:: Before you receive the response, you'll have to click on the link in the
:: dojo to authenticate yourself.
:: You should receive a response listing the contents of that directory.