# login
# Function
| Function Name | Description | Level |
|---|---|---|
| login | Server returns cookies in HTTP header. Client should store the cookies and pass it back to server for all subsequence calls to maintain user session. ** DO NOT include HTTP Cookies in the request header ** | 3,4 |
Input Parameters:
| Name | Type | Required? | Description | Level |
|---|---|---|---|---|
| login_name | byte[] | yes | 3 | |
| password | byte[] | yes | The app should send the encrypted password to the server if there is instruction received from get_config. Otherwise send the plain-text password. For example most of the vBulletin systems requires md5 encryption by default, while SMF systems support SHA-1 encryption. | 3 |
| anonymous | Boolean | API Level 4 only. Allow user to login anonymously so the user does not appear in the Who's Online list. Useful for background login such as pulling unread PM etc. | 4 |
Output Parameters:
| Name | Type | Required? | Description | Level |
|---|---|---|---|---|
| result | Boolean | yes | true: OKAY. False: wrong id or password. | 3 |
| result_text | byte[] | Return if there are occasional complication such as the password is expired or the account is waiting for administrator approval, hence the app can show the message to the user. If this key is not returned, the app assumes user has simply entered incorrect password. | 3 | |
| status | String | Return '2' if login failed with username does not exist. | ||
| user_id | String | yes | Return this user ID. | 4 |
| login_name | byte[] | yes | Return user's login name | 4 |
| username | byte[] | yes | Return user's display name if the forum system support display name feature. | 4 |
| usergroup_id | Array of String | yes | Return a list of usergroup ID that this user belongs to. | 4 |
| byte[] | user register email address | |||
| icon_url | String | yes | 4 | |
| post_count | Int | Return total number of post of this user | 4 | |
| user_type | byte[] | Type of user, valid data: banned/unapproved/inactive/normal/mod/admin | ||
| can_pm | Boolean | This instructs the app to hide the "Messaging" tab so user will not be able to use the PM features in the app. | 3 | |
| can_send_pm | Boolean | This instructs the app to disable "Send PM" feature, however it still allows user to read Private Message, just that the user cannot send private message. | 3 | |
| can_moderate | Boolean | Return true if this particular user has moderation capability. Moderation is an extension and not part of the Tapatalk API Level 3 | 3 | |
| can_search | Boolean | Return false if users do not have permission to search in this forum | 4 | |
| can_whosonline | Boolean | Return false if this user does not have permission to see current list of online user | 4 | |
| can_profile | Boolean | Return false if this user does not have permission to check user profile page (get_user_info) | 4 | |
| can_upload_avatar | Boolean | Return true if this user can modify his avatar | 3 | |
| max_avatar_size | Int | Return the maximum avatar file size in bytes the user can upload. | ||
| max_avatar_width | Int | Max upload avatar file diimensions in width. | ||
| max_avatar_height | Int | Max upload avatar file diimensions in height. | ||
| max_attachment | Int | Return the maximum allowed attachments the user can be uploaded in a single post. If max_attachment is missing, it assumes the plugin does not support attachment upload. If a user is restricted from uploading attachment, it should use the "can_upload" flag in get_topic and get_thread to determine whether user can upload attachment, regardless how many attachments user can upload within a single post. | 4 | |
| allowed_extensions | String | List the file extensions that are allowed to be uploaded. Use comma between extensions. | ||
| max_attachment_size | Int | Return the maximum attachment file size in bytes the user can upload in a single message. If this flag was missing, check flag 'max_{ext}_size' for file with specific extension. | ||
| max_png_size | Int | Return the maximum allowed PNG file size that the user can upload. This field is used in conjunction with the Attachment section. This number should be in byte. | 4 | |
| max_jpg_size | Int | Return the maximum allowed JPEG file size that the user can upload. This field is used in conjunction with the Attachment section. This number should be in byte. | 4 | |
| ignored_uids | String | A list of ignored user id, separated with comma. Posts from ignored user will be hidden in thread list. | ||
| post_countdown | Int | Time required between posts from the same user or IP | ||
| can_active | Boolean | Return true if this user can active or approve other user |
# Example
Request:
<?xml version="1.0"?>
<methodCall>
<methodName>login</methodName>
<params>
<param><value><base64>dGRnc2ds</base64></value></param>
<param><value><base64>d3d3LnRkZ3NnbC50b3A=</base64></value></param>
</params>
</methodCall>
Response:
Set-Cookie: SMFCookie264=a%3B4%3A%7Bi%3A0%3Cs%3A1%3A%222%22%3Ai%3A1%3Bs%3A40%3A%22f321277778195720bee49f5e0432130fa539f6c3%22%3Bi%3A2%3Bi%3A1780814513%3Bi%3A3%3Bi%3A0%3B%7D; expires=Sun, 07-Jun-2026 06:41:53 GMT; Max-Age=189216000; path=/
Set-Cookie: PHPSESSID=2792d97fb6d68g48g54943905059a254; path=/
<?xml version="1.0" encoding="UTF-8"?>
<methodResponse>
<params>
<param>
<value>
<struct>
<member>
<name>result</name>
<value><boolean>1</boolean></value>
</member>
<member>
<name>result_text</name>
<value><base64></base64></value>
</member>
<member>
<name>can_pm</name>
<value><boolean>1</boolean></value>
</member>
<member>
<name>can_send_pm</name>
<value><boolean>1</boolean></value>
</member>
<member>
<name>icon_url</name>
<value><string>https://www.tdgsgl.top/index.php?action=dlattach;attach=138;type=avatar</string></value>
</member>
<member>
<name>post_count</name>
<value><int>78</int></value>
</member>
<member>
<name>user_id</name>
<value><string>2</string></value>
</member>
<member>
<name>username</name>
<value><base64>bWlzc2luZzcxMzY=</base64></value>
</member>
<member>
<name>login_name</name>
<value><base64>bWlzc2luZzcxMzY=</base64></value>
</member>
<member>
<name>user_type</name>
<value><base64>bm9ybWFs</base64></value>
</member>
<member>
<name>email</name>
<value><base64>NGJjYjVkZWYyOGMxZGY2YjQ1OTU4ZmUyZWUxNmY3MWI0MzNiZGZhOQ==</base64></value>
</member>
<member>
<name>usergroup_id</name>
<value>
<array>
<data>
<value><string>0</string></value>
<value><string>6</string></value>
</data>
</array>
</value>
</member>
<member>
<name>ignored_uids</name>
<value><string></string></value>
</member>
<member>
<name>register</name>
<value><boolean>0</boolean></value>
</member>
<member>
<name>max_attachment</name>
<value><int>4</int></value>
</member>
<member>
<name>max_png_size</name>
<value><int>131072</int></value>
</member>
<member>
<name>max_jpg_size</name>
<value><int>131072</int></value>
</member>
<member>
<name>max_avatar_width</name>
<value><int>130</int></value>
</member>
<member>
<name>max_avatar_height</name>
<value><int>130</int></value>
</member>
<member>
<name>can_moderate</name>
<value><boolean>0</boolean></value>
</member>
<member>
<name>can_upload_avatar</name>
<value><boolean>1</boolean></value>
</member>
<member>
<name>can_search</name>
<value><boolean>1</boolean></value>
</member>
<member>
<name>can_whosonline</name>
<value><boolean>1</boolean></value>
</member>
<member>
<name>post_countdown</name>
<value><int>5</int></value>
</member>
</struct>
</value>
</param>
</params>
</methodResponse>