The SDKs have direct support for JWT and OAuth 2.0 authentication, yet in some
cases your application might need to provide an Access Token to the SDK directly.
from box_sdk_gen import BoxClient, BoxDeveloperTokenAuth
auth = BoxDeveloperTokenAuth(token="DEVELOPER_TOKEN_GOES_HERE")
client = BoxClient(auth=auth)
me = client.users.get_user_me()
print(f"My user ID is {me.id}")
using Box.Sdk.Gen;
var auth = new BoxDeveloperTokenAuth(token: "DEVELOPER_TOKEN_GOES_HERE");
var client = new BoxClient(auth: auth));
var me = await client.Users.GetUserMeAsync();
Console.WriteLine($"My user ID is {me.Id}");
from boxsdk import Client, OAuth2
auth = OAuth2(
client_id='YOUR_CLIENT_ID',
client_secret='YOUR_CLIENT_SECRET',
access_token='DEVELOPER_TOKEN_GOES_HERE',
)
client = Client(auth)
me = client.user().get()
print(f'My user ID is {me.id}')
var config = new BoxConfigBuilder("YOUR_CLIENT_ID", "YOUR_CLIENT_SECRET", new Uri("http://localhost")).Build();
var session = new OAuthSession("YOUR_DEVELOPER_TOKEN", "N/A", 3600, "bearer");
var client = new BoxClient(config, session);
var BoxSDK = require('box-node-sdk');
var sdk = new BoxSDK({
clientID: 'YOUR-CLIENT-ID',
clientSecret: 'YOUR-CLIENT_SECRET'
});
var client = sdk.getBasicClient('YOUR-DEVELOPER-TOKEN');
var config = new BoxConfigBuilder("YOUR_CLIENT_ID", "N/A", new Uri("http://localhost")).Build();
var session = new OAuthSession("YOUR_APP_TOKEN", "N/A", 3600, "bearer");
var client = new BoxClient(config, session);
var BoxSDK = require('box-node-sdk');
var sdk = new BoxSDK({
clientID: 'YOUR-CLIENT-ID',
clientSecret: 'unused'
});
var client = sdk.getBasicClient('YOUR-APP-TOKEN');