Skip to main content
Question

JWT PHP Sample Code

  • May 22, 2025
  • 5 replies
  • 2 views

Forum|alt.badge.img

Looking for some PHP sample code to do the following:

 

- JWT Auth

- Directory listing

- Uploading file/folder

 

I've got so far as generated the RSA keypair and downloaded the JSON file.

 

Thanks!

5 replies

Forum|alt.badge.img

Hi ,

 

Thanks for posting to our forums! Box doesn't have an officially supported PHP SDK, but you might be able to find good examples on our community supported projects page:

https://developer.box.com/docs/community-supported-projects

 

Looks like there's a few PHP projects there! Hope that helps!

 

Thanks,

Jason


Forum|alt.badge.img

Thanks.  Unfortunately there isn't any example code for JWT.


Forum|alt.badge.img

So did you find any solution for that ? 🙂


Forum|alt.badge.img

Yes, you can find them in 

https://github.com/maengkom/boxapi

It has JWT PHP functions in BoxAppUser.php

 

composer require maengkom/boxapi
 $config = array(
'au_client_id' => 'client_id',
'au_client_secret' => 'client_secret',
'redirect_uri' => '',
'enterprise_id' => 'enterprise_id',
'app_user_name' => 'app_user_name',
'app_user_id' => 'app_user_name',
'public_key_id' => 'public_key_id',
'passphrase' => 'passphrase',
'expiration' => 60,
'private_key_file' => 'private.pem',
); $box = new BoxAppUser($config); //print_r($box); $info = $box->getFolderInfo('0'); // Get TOP folder information print_r($info);

 

I hope this info helps someone.

 


Forum|alt.badge.img

that package is not working for me on the appuser, I am not being able to get a token. I check the curl command and I can get it work! help!!!