ApiFunction_get_auth_token

Page history last edited by jeremy@... 1 wk ago

get_auth_token

 



 

 

Description

 

This method is used in the authorization process. You should call this method after the user has authorized oneself on the Box.net partner authentication page. Pass the ticket that you get when calling the get_ticket method. 

 

 

Input parameters:

 

Name Type Description
api_key string The API key obtained when registering a project with OpenBox.
ticket string The ticket obtained from the get_ticket API method (part of the initial steps in the authentication process).

 

 

Output parameters:

 

Name Type Description
status string

If the operation was successful, the status will be 'get_auth_token_ok'

If the result was not successful, the status field can be:

  • 'application_restricted' - You provided an invalid api_key, or the api_key is restricted from calling this function

  • 'not_logged_in' - The user did not successfully authenticate on the page provided in the authentication process.

auth_token string The authentication token used for most API methods, to access and apply operations to a user's account.
user SOAPUser, base64binary An object providing basic information about a user's account (user_id, login, amount of storage space, etc).

 

The returned 'user' object in the output will contain the following properties:

 

 

Property Type Description
login string The user's user name.
email string The user's email address.
access_id long If the user is a guest, the access_id will be the user_id of the guest's parent.  If this is a full user, the access_id will be the same as the user_id.
user_id long The unique id that Box.net associates with that user.
space_amount long The total amount of space allocated to that account.
space_used long The amount of space currently utilized by the user.

 

 

REST

 

Request

 

www.box.net/api/1.0/rest?action=get_auth_token&api_key=rrc1d3ntb53tt6b2vhail6rdtrsxov3v&ticket=udd863k39gn9mioc6ym2c6erbqm8qfsh

 

Response

 

<?xml version='1.0' encoding='UTF-8'?>
<response>
<status>get_auth_token_ok</status>
<auth_token>9byo5bg8d2o3otp0voji0ej0v49bqcmo</auth_token>
<user>
<login>stas@itscript.com</login>
<email>stas@itscript.com</email>
<access_id>453</access_id>
<user_id>453</user_id>
<space_amount>2147483648</space_amount>
<space_used>1024</space_used>
</user>
</response>

 

SOAP

 

Request

 

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tns="urn:boxnet"
xmlns:types="urn:boxnet/encodedTypes"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>
<soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<tns:get_auth_token>
<api_key xsi:type="xsd:string">rrc1d3n4b53tt6b2vh1il6tdtrsxov3v</api_key>
<ticket xsi:type="xsd:string">bxquuv025arztljze2n438md9zef95e8</ticket>
</tns:get_auth_token>
</soap:Body>
</soap:Envelope>

 

Response

 

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope  xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns4="urn:boxnet"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
>
<SOAP-ENV:Body>
<ns4:get_auth_tokenResponse>
<status xsi:type="xsd:string">get_auth_token_ok</status>
<auth_token xsi:type="xsd:string">819f55922d47097715b723218176a3a5</auth_token>
<user xsi:type="ns4:SOAPUser">
<login xsi:type="xsd:string">login@email.com</login>
<email xsi:type="xsd:string">login@email.com</email>
<access_id xsi:type="xsd:int">453</access_id>
<user_id xsi:type="xsd:int">453</user_id>
<space_amount xsi:type="xsd:long">2147483648</space_amount>
<space_used xsi:type="xsd:long">49927894</space_used>
</user>
</ns4:get_auth_tokenResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

 

XML

 

Request

 

<?xml version='1.0' encoding='UTF-8' ?>
<request>
<action>get_auth_token</action>
<api_key>rrc1d3ntb53tt6b2vhail6rdtrsxov3v</api_key>
<ticket>udd863k39gn9mioc6ym2c6erbqm8qfsh</ticket>
</request>

 

Response

 

<?xml version='1.0' encoding='UTF-8'?>
<response>
<status>get_auth_token_ok</status>
<auth_token>9byo5bg8d2o3otp0voji0ej0v49bqcmo</auth_token>
<user>
<login>stas@itscript.com</login>
<email>stas@itscript.com</email>
<access_id>453</access_id>
<user_id>453</user_id>
<space_amount>2147483648</space_amount>
<space_used>1024</space_used>
</user>
</response>

 


 

Need additional assistance? Please feel free to Contact us