BenExile / Dropbox

UNMAINTAINED: PHP 5.3 SDK for the Dropbox REST API
MIT License
521 stars 134 forks source link

Too Confusing to use! #15

Closed Jamesking56 closed 12 years ago

Jamesking56 commented 12 years ago

Hey,

This needs a hell of a lot more Documentation as it has caused me many headaches and I still haven't worked out how to use it properly!

I'm trying to build it into my own PHP Class but it isn't going well!

Please add more documentation! Maybe a wiki?

BenExile commented 12 years ago

Hi @Jamesking56

Documentation, wiki and more advanced examples are something I am working on. If you could be more specific about the problems you've been having then I may be able to help you resolve them.

To be fair this is a pretty basic PHP library, provided with examples, and watched by 113 others who haven't had many headaches. I'm sorry you've found it so difficult to work with. What exactly do you mean by building it into your own PHP class?

Jamesking56 commented 12 years ago

I'm making my own PHP class for my project to handle all of the product's functions. How can I build Dropbox into the class so I can create a function that I can use in my main script?

E.g. $dropbox = $MyClass->dropbox();

BenExile commented 12 years ago

Hi @Jamesking56

I'm still unsure of what you mean. If you need a method that returns an instance of the \Dropbox\API class, then do just that...

public function dropbox()
{
    // Set your consumer key, secret and callback URL
    $key      = 'XXXXXXXXXXXXXXXXX';
    $secret   = 'XXXXXXXXXXXXXXXXX';
    $callback = 'http://your-callback-url';

    // Instantiate the required Dropbox objects
    $encrypter = new \Dropbox\OAuth\Storage\Encrypter('XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX');
    $storage   = new \Dropbox\OAuth\Storage\Session($encrypter);
    $OAuth     = new \Dropbox\OAuth\Consumer\Curl($key, $secret, $storage, $callback);
    $dropbox   = new \Dropbox\API($OAuth);

    // Return the Dropbox\API object
    return $dropbox;
}
Jamesking56 commented 12 years ago

What happens if I try to access someone's dropbox account but they haven't connected their dropbox to my app yet? How do I check for this at the class level?

BenExile commented 12 years ago

@Jamesking56

At present there is no persistent token storage, meaning if you wish to save the tokens for users then you will need to write your own storage handler. I made the decision not to provide database storage handler in the first instance as it needs more planning to make it as compatible as possible with the many authentication components that are available.

As I'm not familiar with your application it makes it difficult to make suggestions on where to store your tokens and how to check if a token has been acquired for a specific user. More generically I would suggest creating a table where you will store OAuth tokens against user ID's, checking this table for the authenticated user and either beginning the OAuth flow (if no token has been stored for that user), or setting the token already stored for that user (see Dropbox\OAuth\Storage\Session::set()).

Storing OAuth tokens persistently will be added, but there is no timescale on this as of yet.

BenExile commented 12 years ago

Issue closed as there is no specific issue to deal with, more specific integration questions.

amsgulliver70 commented 10 years ago

This is an absolute abhorrent mess of a system - as a school we have inherited all documentation via gitthub which is inaccessible wrapped up in html code with underlying content simply impenetrable. What an absolute nightmare.....it is fair to say github is for the geeks and for those who want to keep it simple and engage learners this is not for you. Sort it out and make it user friendly and stop using your egos just because you have spent hours and hours used to this drivel to belittle anyone who does not understand why the hell this exists....

Should be removed.

ghost commented 10 years ago

@amsgulliver70 - instead of ranting, why don't you:

You say

"it is fair to say github is for the geeks"

and yet you've managed to fork and make commits to the ams-ICT repo.

Come on - I know almost NOTHING about coding, and even I managed to implement this.

BenExile commented 10 years ago

@amsgulliver70 Can I clarify what your frustrations are? Are they specifically with this library, or with GitHub as a platform? Here to be as helpful as possible but, to put it bluntly, you need to be less of a b***h and stop whining. 540 people have starred this repository, some have paid me for it (even though it's available for free), and according to Packagist it has been installed 3,400+ times. It can't be that bad ;)

@digitaltoast "as you appear to have written the computing curriculum... Fork it, improve it, write a better one, or use something different." :+1: