### Login Request Example Source: https://github.com/dhwani-ris/frappe-mobile-control/blob/develop/README.md Example JSON payload for initiating a login with username and password. ```json { "username": "your.username", "password": "your.password" } ``` -------------------------------- ### Get Permissions Request Example Source: https://github.com/dhwani-ris/frappe-mobile-control/blob/develop/README.md Example request to retrieve current user roles and doctype permissions. Requires a Bearer token. ```http GET {{base_url}}/api/method/mobile_auth.permissions Authorization: Bearer ``` -------------------------------- ### Get Translations Request Example Source: https://github.com/dhwani-ris/frappe-mobile-control/blob/develop/README.md Example URL for fetching translation dictionaries. Supports specifying language codes and retrieving all translations. ```http GET /api/method/mobile_auth.get_translations?lang=hi (Bearer token required). Omit `lang` for English (`en`). Add `&all=1` or `&all=true` to get **full translations** (apps CSV/MO + DB). For **multiple languages**, use comma-separated codes: `?lang=hi,en`. ``` -------------------------------- ### Install and Enable Pre-commit Hooks Source: https://github.com/dhwani-ris/frappe-mobile-control/blob/develop/README.md Navigate to the app directory and install the pre-commit hooks. This ensures code formatting and linting are applied before commits. ```bash cd apps/mobile_control pre-commit install ``` -------------------------------- ### Logout Request Example Source: https://github.com/dhwani-ris/frappe-mobile-control/blob/develop/README.md Example header for initiating a logout. Requires a Bearer token. ```http Authorization: Bearer ``` -------------------------------- ### Install Frappe Mobile Control App Source: https://github.com/dhwani-ris/frappe-mobile-control/blob/develop/README.md Install the mobile_control app using the bench CLI. Ensure you are in your Frappe bench directory and have the repository URL. ```bash cd $PATH_TO_YOUR_BENCH bench get-app $URL_OF_THIS_REPO --branch develop bench install-app mobile_control ``` -------------------------------- ### Install Pre-commit Hooks Source: https://github.com/dhwani-ris/frappe-mobile-control/blob/develop/CONTRIBUTING.md Installs pre-commit hooks to ensure code quality and consistency before committing changes. This is a recommended step for all contributors. ```bash pip install pre-commit pre-commit install ``` -------------------------------- ### Verify OTP Request Example Source: https://github.com/dhwani-ris/frappe-mobile-control/blob/develop/README.md Example JSON payload for verifying an OTP to complete the login process. ```json { "tmp_id": "TMP_ID_FROM_SEND_OTP", "otp": "123456" } ``` -------------------------------- ### Send OTP Request Example Source: https://github.com/dhwani-ris/frappe-mobile-control/blob/develop/README.md Example JSON payload for sending an OTP to a mobile number. ```json { "mobile_no": "+15551234567" } ``` -------------------------------- ### Refresh Token Request Example Source: https://github.com/dhwani-ris/frappe-mobile-control/blob/develop/README.md Example JSON payload for refreshing an access token using a refresh token. ```json { "refresh_token": "REFRESH_TOKEN" } ``` -------------------------------- ### Example Social Login Providers Response Source: https://github.com/dhwani-ris/frappe-mobile-control/blob/develop/README.md Example JSON response when querying for social login providers. It lists available providers with their IDs, labels, and icon URLs. ```json { "providers": [ { "id": "google", "label": "Google", "icon_url": "https://..." }, { "id": "microsoft", "label": "Microsoft", "icon_url": null } ] } ``` -------------------------------- ### Get App Configuration Source: https://github.com/dhwani-ris/frappe-mobile-control/blob/develop/README.md Retrieves the list of mobile configurations for the application. ```APIDOC ## GET /api/method/mobile_auth.app_configuration ### Description Fetches the list of mobile configurations available for the application. This endpoint is accessible to guests and provides details about the app's configuration settings. ### Method GET ### Endpoint /api/method/mobile_auth.app_configuration ### Response #### Success Response (200) (Response shape not explicitly detailed, but it is described as a list of mobile configuration items.) ``` -------------------------------- ### Get Social Login Providers Source: https://github.com/dhwani-ris/frappe-mobile-control/blob/develop/README.md Discovers enabled social login providers from `Social Login Key` configuration. This endpoint is available to guests. ```APIDOC ## GET /api/method/mobile_auth.get_social_login_providers ### Description Discovers enabled social providers from `Social Login Key`. Available to guests. ### Method GET ### Endpoint /api/method/mobile_auth.get_social_login_providers ### Response #### Success Response (200) - **providers** (array) - A list of available social login providers. - **id** (string) - The unique identifier for the provider (e.g., `google`). - **label** (string) - The display name for the provider (e.g., `Google`). - **icon_url** (string) - The URL for the provider's icon, or null if not available. ### Response Example ```json { "providers": [ { "id": "google", "label": "Google", "icon_url": "https://..." }, { "id": "microsoft", "label": "Microsoft", "icon_url": null } ] } ``` ``` -------------------------------- ### Get App Status Source: https://github.com/dhwani-ris/frappe-mobile-control/blob/develop/README.md Retrieves the status of the mobile application, including enabled status, package name, title, and version. ```APIDOC ## GET /api/method/mobile_auth.app_status ### Description Provides the current status of the mobile application. This endpoint is accessible to guests and returns information such as whether the app is enabled, its package name, title, and version. ### Method GET ### Endpoint /api/method/mobile_auth.app_status ### Response #### Success Response (200) - **enabled** (boolean) - Indicates if the mobile app is enabled. - **package_name** (string) - The package name of the mobile application. - **app_title** (string) - The title of the mobile application. - **version** (string) - The version of the mobile application. ``` -------------------------------- ### Discover Social Login Providers Source: https://github.com/dhwani-ris/frappe-mobile-control/blob/develop/README.md Use this GET endpoint to discover enabled social login providers configured in Frappe's Social Login Key. ```http GET /api/method/mobile_auth.get_social_login_providers ``` -------------------------------- ### Get Permissions Source: https://github.com/dhwani-ris/frappe-mobile-control/blob/develop/README.md Retrieves the current user's permissions. This endpoint requires authentication. ```APIDOC ## POST /api/v2/method/mobile_auth.permissions ### Description Gets the current user's permissions. Requires authentication. ### Method POST ### Endpoint /api/v2/method/mobile_auth.permissions ``` -------------------------------- ### Get User Permissions Source: https://github.com/dhwani-ris/frappe-mobile-control/blob/develop/README.md Retrieves the current user's roles and doctype-level permissions. ```APIDOC ## GET /api/method/mobile_auth.permissions ### Description Fetches the current user's assigned roles and specific permissions (read, write, create, delete, submit, cancel, amend) for various doctypes. This endpoint allows refreshing permissions without requiring a full re-authentication. ### Method GET ### Endpoint /api/method/mobile_auth.permissions ### Headers - **Authorization**: Bearer - Required - The access token for authentication. ### Response #### Success Response (200) - **roles** (array) - Array of user role names. - **permissions** (array) - Array of objects, each detailing doctype permissions: - **doctype** (string) - The name of the doctype. - **read** (boolean) - Whether the user has read permission. - **write** (boolean) - Whether the user has write permission. - **create** (boolean) - Whether the user has create permission. - **delete** (boolean) - Whether the user has delete permission. - **submit** (boolean) - Whether the user has submit permission. - **cancel** (boolean) - Whether the user has cancel permission. - **amend** (boolean) - Whether the user has amend permission. #### Response Example ```json { "roles": ["Mobile User", "System Manager"], "permissions": [ { "doctype": "Customer", "read": true, "write": true, "create": true, "delete": false, "submit": true, "cancel": false, "amend": false } ] } ``` ``` -------------------------------- ### Get Translations Source: https://github.com/dhwani-ris/frappe-mobile-control/blob/develop/README.md Retrieves translation strings for a specified language. ```APIDOC ## GET /api/method/mobile_auth.get_translations ### Description Fetches translation strings for a given language. By default, it returns database translations. Appending `&all=1` includes full translations from app CSV/MO files. Multiple languages can be requested using comma-separated codes. ### Method GET ### Endpoint /api/method/mobile_auth.get_translations ### Query Parameters - **lang** (string) - Optional - The language code (e.g., `hi`, `en`). Defaults to `en` if omitted. - **all** (boolean) - Optional - If set to `1` or `true`, includes full translations from app files in addition to DB translations. ### Headers - **Authorization**: Bearer - Required - The access token for authentication. ### Request Example `GET {{base_url}}/api/method/mobile_auth.get_translations?lang=hi&all=1` ### Response #### Success Response (200) - **langs** (array) - Array of language codes for which translations are returned. - **translations_by_lang** (object) - An object where keys are language codes. Each value is an object containing source text as keys and translated text as values. #### Response Example ```json { "langs": ["hi"], "translations_by_lang": { "hi": { "source text": "translated text", "Another source": "Another translation" } } } ``` (If multiple languages are requested, `langs` will contain multiple codes, and `translations_by_lang` will have corresponding entries.) ``` -------------------------------- ### Get Social Authorize URL Source: https://github.com/dhwani-ris/frappe-mobile-control/blob/develop/README.md Use this POST endpoint to generate a provider-direct OAuth authorize URL for one-tap social login. Requires provider details and PKCE parameters. ```http POST /api/v2/method/mobile_auth.get_social_authorize_url ``` -------------------------------- ### Get Social Authorize URL Source: https://github.com/dhwani-ris/frappe-mobile-control/blob/develop/README.md Builds a provider-direct OAuth authorize URL for one-tap social login. This endpoint is intended for mobile SDK OAuth (PKCE) login and is available to guests. ```APIDOC ## POST /api/v2/method/mobile_auth.get_social_authorize_url ### Description Builds a provider-direct OAuth authorize URL for one-tap social login. Available to guests. ### Method POST ### Endpoint /api/v2/method/mobile_auth.get_social_authorize_url ### Parameters #### Request Body - **provider** (string) - Required - The ID of the social login provider (e.g., `google`). - **client_id** (string) - Required - Your Frappe OAuth Client ID. - **redirect_uri** (string) - Required - The mobile callback URI, typically `frappemobilesdk://oauth/callback`. - **scope** (string) - Required - The OAuth scope (e.g., `openid all`). - **state** (string) - Required - A random string to maintain state. - **code_challenge** (string) - Required - The PKCE code challenge. - **code_challenge_method** (string) - Required - The PKCE code challenge method (e.g., `S256`). ### Request Example ```json { "provider": "google", "client_id": "mobile-client-id", "redirect_uri": "frappemobilesdk://oauth/callback", "scope": "openid all", "state": "random-state", "code_challenge": "pkce-code-challenge", "code_challenge_method": "S256" } ``` ### Response #### Success Response (200) - **authorize_url** (string) - The generated OAuth authorize URL. ### Response Example ```json { "authorize_url": "https://accounts.google.com/o/oauth2/v2/auth?...state=" } ``` ``` -------------------------------- ### Social Authorize URL Response Source: https://github.com/dhwani-ris/frappe-mobile-control/blob/develop/README.md Example response containing the generated OAuth authorize URL for a social login provider. This URL is used to initiate the social login flow. ```json { "authorize_url": "https://accounts.google.com/o/oauth2/v2/auth?...state=" } ``` -------------------------------- ### Get Translations Source: https://github.com/dhwani-ris/frappe-mobile-control/blob/develop/README.md Retrieves translation dictionaries for specified languages. Requires authentication. By default, returns DB translations only; use `all=1` for full translations (apps + DB). Use `lang=hi,en` for multiple languages. ```APIDOC ## POST /api/v2/method/mobile_auth.get_translations ### Description Gets translation dictionary for one or more languages. Requires authentication. ### Method POST ### Endpoint /api/v2/method/mobile_auth.get_translations ### Parameters #### Query Parameters - **lang** (string) - Optional - Comma-separated list of language codes (e.g., `hi,en`). - **all** (integer) - Optional - Set to `1` to include full translations (apps + DB); defaults to DB translations only. ``` -------------------------------- ### Run All Pre-commit Checks Source: https://github.com/dhwani-ris/frappe-mobile-control/blob/develop/CONTRIBUTING.md Executes all configured pre-commit hooks across all files in the repository. This is a crucial step to ensure code formatting, linting, and repository hygiene before pushing changes. ```bash pre-commit run --all-files ``` -------------------------------- ### Login with username and password Source: https://github.com/dhwani-ris/frappe-mobile-control/blob/develop/README.md Authenticates a user using their username and password. Returns access and refresh tokens, user roles, permissions, and language. ```APIDOC ## POST /api/v2/method/mobile_auth.login ### Description Authenticates a user with username and password. Upon successful authentication, it returns an access token, a refresh token, user roles, permissions, and the user's language preference. ### Method POST ### Endpoint /api/v2/method/mobile_auth.login ### Request Body - **username** (string) - Required - The user's username. - **password** (string) - Required - The user's password. ### Request Example ```json { "username": "your.username", "password": "your.password" } ``` ### Response #### Success Response (200) - **message** (string) - Confirmation message. - **user** (string) - The authenticated user's email. - **full_name** (string) - The user's full name. - **language** (string) - The user's preferred language. - **access_token** (string) - The JWT access token for API authentication. - **refresh_token** (string) - The token used to obtain a new access token. - **offline_enabled** (boolean) - Indicates if offline mode is enabled for the mobile client. - **mobile_form_names** (array) - List of mobile-configured form names. - **roles** (array) - Array of user role names. - **permissions** (array) - Array of doctype-level permissions for the user. #### Response Example ```json { "message": "Logged In", "user": "user@example.com", "full_name": "User Name", "language": "en", "access_token": "...", "refresh_token": "...", "offline_enabled": false, "mobile_form_names": [ { "mobile_workspace_item": "Mobile Refresh Token", "group_name": "", "doctype_meta_modifed_at": "2026-02-14 14:40:49.962439", "doctype_icon": "" } ], "roles": ["Mobile User", "All", "Desk User"], "permissions": [ { "doctype": "Mobile Refresh Token", "read": true, "write": false, "create": true, "delete": false, "submit": false, "cancel": false, "amend": false } ] } ``` ``` -------------------------------- ### Login Source: https://github.com/dhwani-ris/frappe-mobile-control/blob/develop/README.md Logs in a user with their username and password. This is a whitelisted method intended for mobile clients. ```APIDOC ## POST /api/v2/method/mobile_auth.login ### Description Logs in a user with username and password. ### Method POST ### Endpoint /api/v2/method/mobile_auth.login ### Parameters #### Request Body - **username** (string) - Required - The user's username. - **password** (string) - Required - The user's password. ``` -------------------------------- ### Verify OTP and Login Source: https://github.com/dhwani-ris/frappe-mobile-control/blob/develop/README.md Verifies the OTP sent to the user's mobile number and completes the login process. ```APIDOC ## POST /api/v2/method/mobile_auth.verify_login_otp ### Description Verifies the One-Time Password (OTP) provided by the user against the one sent to their mobile number. Upon successful verification, it logs the user in and returns access and refresh tokens, along with user roles and permissions. ### Method POST ### Endpoint /api/v2/method/mobile_auth.verify_login_otp ### Request Body - **tmp_id** (string) - Required - The temporary ID received from the `send_login_otp` request. - **otp** (string) - Required - The One-Time Password entered by the user. ### Request Example ```json { "tmp_id": "TMP_ID_FROM_SEND_OTP", "otp": "123456" } ``` ### Response (Response shape is similar to the login response, including `access_token`, `refresh_token`, `roles`, and `permissions`.) ``` -------------------------------- ### Verify Login OTP Source: https://github.com/dhwani-ris/frappe-mobile-control/blob/develop/README.md Verifies the provided One-Time Password (OTP) and completes the login process. This is a whitelisted method intended for mobile clients. ```APIDOC ## POST /api/v2/method/mobile_auth.verify_login_otp ### Description Verifies the OTP and completes the login. ### Method POST ### Endpoint /api/v2/method/mobile_auth.verify_login_otp ### Parameters #### Request Body - **mobile_number** (string) - Required - The mobile number associated with the OTP. - **otp** (string) - Required - The One-Time Password received. ``` -------------------------------- ### Send OTP for login Source: https://github.com/dhwani-ris/frappe-mobile-control/blob/develop/README.md Sends an OTP to the specified mobile number for login verification. ```APIDOC ## POST /api/v2/method/mobile_auth.send_login_otp ### Description Initiates the login process by sending a One-Time Password (OTP) to the user's registered mobile number. The response typically includes a temporary ID required for the OTP verification step. ### Method POST ### Endpoint /api/v2/method/mobile_auth.send_login_otp ### Request Body - **mobile_no** (string) - Required - The mobile number to which the OTP will be sent. ### Request Example ```json { "mobile_no": "+15551234567" } ``` ### Response (Response shape not explicitly detailed, but typically includes a temporary ID for verification.) ``` -------------------------------- ### Send Login OTP Source: https://github.com/dhwani-ris/frappe-mobile-control/blob/develop/README.md Sends an One-Time Password (OTP) to the user's mobile number for login purposes. This is a whitelisted method intended for mobile clients. ```APIDOC ## POST /api/v2/method/mobile_auth.send_login_otp ### Description Sends an OTP to the mobile number for login. ### Method POST ### Endpoint /api/v2/method/mobile_auth.send_login_otp ### Parameters #### Request Body - **mobile_number** (string) - Required - The mobile number to send the OTP to. ``` -------------------------------- ### Refresh Access Token Source: https://github.com/dhwani-ris/frappe-mobile-control/blob/develop/README.md Obtains a new access token and refresh token pair using a valid refresh token. ```APIDOC ## POST /api/v2/method/mobile_auth.refresh_token ### Description Renews the user's session by obtaining a new `access_token` and `refresh_token` pair using a valid existing `refresh_token`. This is used when the current `access_token` has expired. ### Method POST ### Endpoint /api/v2/method/mobile_auth.refresh_token ### Request Body - **refresh_token** (string) - Required - The refresh token obtained during login. ### Request Example ```json { "refresh_token": "REFRESH_TOKEN" } ``` ### Response (Response shape is similar to the login response, including new `access_token` and `refresh_token`.) ``` -------------------------------- ### Permissions Response Shape Source: https://github.com/dhwani-ris/frappe-mobile-control/blob/develop/README.md The structure of the response received when requesting user permissions. Includes roles and doctype-specific permissions. ```json { "roles": ["Mobile User", "System Manager"], "permissions": [ { "doctype": "Customer", "read": true, "write": true, "create": true, "delete": false, "submit": true, "cancel": false, "amend": false } ] } ``` -------------------------------- ### Logout Source: https://github.com/dhwani-ris/frappe-mobile-control/blob/develop/README.md Logs out the user by revoking their refresh tokens. ```APIDOC ## POST /api/v2/method/mobile_auth.logout ### Description Logs the user out by revoking their associated refresh tokens, effectively invalidating their session. Requires authentication via an access token. ### Method POST ### Endpoint /api/v2/method/mobile_auth.logout ### Headers - **Authorization**: Bearer - Required - The access token for authentication. ### Request Example (No request body, only Authorization header required.) ``` Authorization: Bearer ``` ``` -------------------------------- ### Social Authorize URL Request Body Source: https://github.com/dhwani-ris/frappe-mobile-control/blob/develop/README.md The request body for generating a social authorize URL. Include the provider, client ID, redirect URI, scope, state, and PKCE challenge. ```json { "provider": "google", "client_id": "mobile-client-id", "redirect_uri": "frappemobilesdk://oauth/callback", "scope": "openid all", "state": "random-state", "code_challenge": "pkce-code-challenge", "code_challenge_method": "S256" } ``` -------------------------------- ### Auth Response Shape Source: https://github.com/dhwani-ris/frappe-mobile-control/blob/develop/README.md The structure of the response received after login, OTP verification, or token refresh. Includes user details, tokens, and permissions. ```json { "message": "Logged In", "user": "user@example.com", "full_name": "User Name", "language": "en", "access_token": "...", "refresh_token": "...", "offline_enabled": false, "mobile_form_names": [ { "mobile_workspace_item": "Mobile Refresh Token", "group_name": "", "doctype_meta_modifed_at": "2026-02-14 14:40:49.962439", "doctype_icon": "" } ], "roles": ["Mobile User", "All", "Desk User"], "permissions": [ { "doctype": "Mobile Refresh Token", "read": true, "write": false, "create": true, "delete": false, "submit": false, "cancel": false, "amend": false } ] } ``` -------------------------------- ### Logout Source: https://github.com/dhwani-ris/frappe-mobile-control/blob/develop/README.md Logs out the current user and revokes their refresh tokens. This is a whitelisted method intended for mobile clients. ```APIDOC ## POST /api/v2/method/mobile_auth.logout ### Description Logs out the user and revokes refresh tokens. ### Method POST ### Endpoint /api/v2/method/mobile_auth.logout ``` -------------------------------- ### Refresh Token Source: https://github.com/dhwani-ris/frappe-mobile-control/blob/develop/README.md Refreshes the access token using a valid refresh token. This is a whitelisted method intended for mobile clients. ```APIDOC ## POST /api/v2/method/mobile_auth.refresh_token ### Description Refreshes the access token using the refresh token. ### Method POST ### Endpoint /api/v2/method/mobile_auth.refresh_token ### Parameters #### Request Body - **refresh_token** (string) - Required - The refresh token to use for obtaining a new access token. ``` -------------------------------- ### Translations Response Shape Source: https://github.com/dhwani-ris/frappe-mobile-control/blob/develop/README.md The structure of the response for translation requests. Contains language codes and a map of source texts to translated texts. ```json { "langs": ["hi"], "translations_by_lang": { "hi": { "source text": "translated text", ... } } } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.