linkstreet/box-sdk

Client Error

Opened this issue · 2 comments

I tried to connect laravel to box api but I receive this error message

GuzzleHttp\Exception\ClientException
Client error: POST https://api.box.com/oauth2/token resulted in a 400 Bad Request response: {"error":"invalid_grant","error_description":""kid" invalid, unable to lookup correct key"}

@gianadrias hope you filled correct values for client_id and client_secret

use Linkstreet\Box\Box;
use Linkstreet\Box\Enums\SubscriptionType;

$box_sdk = new Box(['client_id' => "", "client_secret" => ""]);

$app_auth_info = [
    "key_id" => "key id from box app",
    "private_key" => "path to private key",
    "pass_phrase" => "passphrase", // Can be empty
    "subscription_type" => SubscriptionType::ENTERPRISE or SubscriptionType::USER,
    "id" => "enterprise id or user id"
];

// Authenticates with box server and returns app_auth instance.
// Throws `GuzzleHttp\Exception\ClientException` on failure 
$app_auth_instance = $box_sdk->getAppAuthClient($app_auth_info);

@gianadrias hope the response helped you. Could you please confirm if I can close this issue?