Skip to content

Bad Request 400 if using App Key and App Secret #94

@skunkbad

Description

@skunkbad

I'm converting some existing code to use your package because the old package locked us into Guzzle 6.x. So I already have an app key, app secret, and non-expiring access token.

According to your documentation, it looks like I should be able to supply the app key and app secret in an array to the constructor of Client, or I can provide the access token as a string. The access token as a string works to connect, but with the array of app key and app secret I get a Bad Request 400 error. My test code shown below:

public function testDropboxConnection()
{
	require WILDFISH_CONFIGS_DIR . '.dropbox.php';    
	$dropboxConfig = getWassDropboxConfig('production');    
	try{
		$client = new \Spatie\Dropbox\Client( $dropboxConfig['accessToken'] );

		// For some reason this doesn't work...
		/*$client = new \Spatie\Dropbox\Client([
			$dropboxConfig['appKey'], 
			$dropboxConfig['appSecret']
		]);*/    
		dump( $client->getAccountInfo() );
	}
	catch( \Spatie\Dropbox\Exceptions\BadRequest $e )
	{
		if( ENVIRONMENT == 'development' && TRUE )
			dump( $e );
	}
	catch( \Exception $e )
	{
		if( ENVIRONMENT == 'development' && TRUE )
			dump( $e );
	}
}

Since I have it working with the access token, it's not critical for me that you fix this, but it did waste some of my time, so I thought I'd leave this here so you can take a look.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions