注釈トークンとは、ユーザーが注釈を付けることができるファイルに対してアプリケーションがプレビューの埋め込みリンクを作成できるようにするアクセストークンです。アプリケーションでは、アプリケーションのユーザーそれぞれに新しいApp Userが作成されない可能性があるため、注釈トークンを使用すると、注釈を付けたユーザーを追跡できます。The Annotator Token is used instead of a regular Access Token or File
Token to generate a preview session (an expiring embed link) that is linked to a
unique user ID and display name.
var claims = new List<Claim>{ new Claim("sub", '[EXTERNAL_USER_ID]'), new Claim("name", '[EXTERNAL_USER_DISPLAY_NAME]'), new Claim("box_sub_type", "external"), new Claim("jti", jti),};
Then, convert this claim to an assertion according to the guide and pass this
assertion to the
endpoint together with an existing valid Access Token or File Token,
as well as a set of scopes, and the resource for which to create the token.
var content = new FormUrlEncodedContent(new[]{ new KeyValuePair<string, string>( "grant_type", "urn:ietf:params:oauth:grant-type:token-exchange"), new KeyValuePair<string, string>( "resource", "https://api.box.com/2.0/files/123456"), new KeyValuePair<string, string>( "subject_token", "[ACCESS_TOKEN]"), new KeyValuePair<string, string>( "subject_token_type", "urn:ietf:params:oauth:token-type:access_token"), new KeyValuePair<string, string>( "scope", "item_preview"), new KeyValuePair<string, string>( "actor_token", "[JWT_ASSERTION_FOR_ANNOTATOR_TOKEN]"), new KeyValuePair<string, string>( "actor_token_type", "urn:ietf:params:oauth:token-type:id_token"),});