Skip to content
Karol Herbst edited this page May 14, 2014 · 6 revisions

Table of Contents

Login

The login request is used to validate a members username and password. Invalid details will result in an error, valid details will result in the users session been created and their profile information returned to the application.

Input

URL

 * http://api.desura.com/3/memberlogin
 * https://secure.desura.com/3/memberlogin

Post

 * username: Required, 20 chars max
 * password: Required, 4 chars min, 20 chars max (can be md5 hash, provided this value is 32chars long)

Process

 1. When the login API is called, the username and password will be validated according to the rules below:
   * Invalid data will result in a 107 (validation error) being thrown.
   * If the username and password fields are valid, the information will be matched in the database.
     * If the username exists but password is incorrect a 103 (invalid password) error will be thrown.
     * If the username cannot be found a 104 (invalid username) error will be thrown.
     * If the username exists but account isn't activated a 105 (account not active) error will be thrown.
     * If the username exists but account is banned a 106 (account banned) error will be thrown.
     * If the username exists but account is suspended a 109 (account suspended for creditcard chargeback) error will be thrown.
     * If more than 5 failed login attempts are made, a 108 (permission denied) error will be thrown. The user will need to wait 5 minutes before trying again.
   * Any other errors will result in a 100 (generic error) message being thrown.
 1. If a valid username / password is provided, the following cookies will be set:
   * freeman: login token
   * masterchief: session ID
 1. Also 0 (ok) will be returned along with the users profile information.

Output

0: Ok

<?xml version="1.0" encoding="utf-8"?> 
<memberlogin xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="desura" version="2">
	<status code="0"/>
	<member siteareaid="1346">
		<admin>0</admin>
		<name>pizza</name>
		<nameid>pizza</nameid>
		<url>http://www.gamedev.com/members/pizza</url>
		<urledit>http://www.gamedev.com/members/edit/pizza</urledit>
		<email>scott@moddb.com</email>
		<firstname>Scott</firstname>
		<lastname>Reismanis</lastname>
		<timezone>UTC</timezone>
		<language>en</language>
		<country>AU</country>
		<age>1980-05-09</age>
		<gender>Male</gender>
		<datelastvisit>20081030125847</datelastvisit>
		<avatar>http://static.gamedev.com/borderless/images/default/error_50x50.png</avatar>
		<cookies>
			<id>1|2e78ed9e356ab1bfffbce73d279638cf|febed9c7e11fe84048c4e579290a1044</id>
			<session>67d8a06cdf5ce2043d948d204e85b496</session>
		</cookies>
		<messages>
			<cart>0</cart>
			<threadwatch>0</threadwatch>
			<updates>16</updates>
			<privatemessages>0</privatemessages>
		</messages>
		<news>
			<item id="1" cat="1">
				<title>Source Mods now available</title>
				<url>http://www.desura.com/news/source-mods</url>
			</item>
		</news>
		<gifts>
			<gift id="1">
				<title>Sven Co-op Special Edition</title>
				<url>https://secure.desura.com/cart/gift/view/84cc3277cb6d073fc7a93356cd3a8816</url>
			</gift>
		</gifts>
	</member>
</memberlogin>

107: Validation Error

<?xml version="1.0" encoding="utf-8"?> 
<memberlogin xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="desura" version="2">
	<status code="107">
	The username field is required.
	The password field is required.
	</status>
	<validation>
		<fields>
			<username>The username field is required.</username>
			<password>The password field is required.</password>
		</fields>
	</validation>
</memberlogin>

105: Account Not Active

<?xml version="1.0" encoding="utf-8"?> 
<memberlogin xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="desura" version="2">
	<status code="105">You have not activated your account. Please follow the instructions in your welcome email to activate your account. If you have not received your activation email, please try registering again.</status>
</memberlogin>

103: Invalid Password

104: Invalid Username / Password

106: Account Banned

109: Account Suspended

100: Generic Error

As above, only with different status code and text.
Clone this wiki locally