|
Jacques Joubert - 2016-11-09 08:59:06 - In reply to message 10 from Manuel Lemos
1) I am trying to call the api v2, without redirect.
2) I am trying to get the access token manually. The auth link is generated, it says "enter this token in your app to complete" I then copy that token. Then I specify $Client->access_token = <copied token>
Maybe I am understanding the flow wrong?
New Design - 2016-11-09 09:06:52 - In reply to message 11 from Jacques Joubert
I don't know where you can see that you can do that. Is there a page that explains that works?
Jacques Joubert - 2016-11-09 09:49:11 - In reply to message 12 from New Design
Like I said, perhaps I am getting this all wrong, but from what I do know:
1) Dropbox API v2 no longer supports Call Backs, instead it has a redirect function.
2) The redirect url must be SSL (https) it only supports non SSL for localhost, for testing.
3) The redirect url MUST be an exact url match to what is registered on Dropbox.
3.1) This makes things harder to create a plugin for a web platform.
3.2) So either your app/plugin must be customized specifically with its own api key and secret on a website that is SSL, or you do not specify a redirect url.
3.3) If no redirect url is provided, after the user "authorized" the apps access request the page provides the user with a access token which must then be copied and pasted in your app to complete the process manually. This is where I run into trouble.
Manuel Lemos - 2016-11-09 18:20:39 - In reply to message 13 from Jacques Joubert
The redirect is necessary for the user to grant access to the API on his behalf.
There are free SSL certificates for instance from StartSSL or LetsEncrypt.
In development environment, you can use self-signed certificates even if you do not use localhost.
If you need different redirect URLs create multiple applications. If you just want to use one, make all OAuth process happens in that page.
Jacques Joubert - 2016-11-14 13:42:54 - In reply to message 15 from Manuel Lemos
Please can you just try this and see where I am at or what I am trying to do:
add to oauth_configuration.json:
"Dropboxv2":
{
"oauth_version": "2.0",
"dialog_url": "https://api.dropbox.com/oauth2/authorize?response_type=code&client_id={CLIENT_ID}&scope={SCOPE}&state={STATE}",
"access_token_url": "https://www.dropbox.com/oauth2/token"
},
<?php
require('http.php');
require('oauth_client.php');
$client = new oauth_client_class;
$client->server = 'Dropboxv2';
$client->client_id = 'ENTER YOUR KEY';
$client->client_secret = 'ENTER YOUR SECRET';
$success = $client->Initialize();
$client->CheckAccessToken($redirect_url);
if(isset($redirect_url))
{
echo sprintf('<a href="%s" target="_blank" title="Authorixe Dropbox">Authorixe Dropbox</a>', $redirect_url);
}
?>
Jacques Joubert - 2016-11-14 15:46:12 - In reply to message 16 from Jacques Joubert
Got it to work!
Had to define:
$client->access_token_type = 'Bearer';
Manuel Lemos - 2017-03-01 21:44:31 - In reply to message 17 from Jacques Joubert
Sorry for the delay. I looked into this and using the server set to Dropbox2v2, the token type does not need to be set to bearer because Dropbox sets it to bearer already.
|