CreateApplication

Updated at:

Creates an application.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

ram:CreateApplication

create

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

DisplayName

string

Yes

The display name of the application.

Maximum length: 24 characters.

myapp

AppType

string

Yes

The application type. Valid values:

  • WebApp: web applications that interact with users through browsers.

  • NativeApp: native applications that run in operating systems, primarily on desktop or shift operating systems.

  • ServerApp: applications that directly access Alibaba Cloud services without requiring user logons. Currently, only user synchronization applications based on the System for Cross-domain Identity Management protocol are supported.

WebApp

RedirectUris

string

No

The redirect URIs.

Separate multiple URIs with semicolons (;).

https://www.example.com

SecretRequired

boolean

No

Specifies whether an application secret is required. Valid values:

  • true

  • false

Note
    • For WebApp and ServerApp applications, this value is forcibly set to true and cannot be modified.

    • For NativeApp applications, you can set this value to true or false. If you do not specify this value, the default value is false. Because such applications often run in untrusted environments and cannot effectively protect application secrets, do not set this value to true unless necessary. For more information, see Log on to Alibaba Cloud from a native application.

true

AccessTokenValidity

integer

No

The validity period of the access token.

Valid values: 900 to 10800. Unit: seconds.

Default value: 3600.

3600

RefreshTokenValidity

integer

No

The validity period of the refresh token.

Valid values: 7200 to 31536000. Unit: seconds.

Default value:

  • For NativeApp and ServerApp applications, if this value is empty, the default value is 2592000 seconds (30 days).

  • For WebApp applications, if this value is empty, the default value is 7776000 seconds (90 days).

2592000

PredefinedScopes

string

No

The scopes of the application.

For the valid values and descriptions of application scopes, see OAuth scopes. You can also call the ListPredefinedScopes operation to obtain the scopes supported by different application types.

Separate multiple scopes with semicolons (;).

aliuid;profile

RequiredScopes

string

No

The required scopes of the application.

You can set one or more scopes in RequiredScopes as required. After a scope is set as required, it is selected by default and cannot be deselected when a user authorizes the application.

Separate multiple scopes with semicolons (;).

Note

If a scope that you specify in RequiredScopes is not included in PredefinedScopes, the required scope does not take effect.

aliuid

IsMultiTenant

boolean

No

Specifies whether the application can be installed by other accounts. Valid values:

  • true: For NativeApp and ServerApp applications, if this value is empty, the default value is true.

  • false: For WebApp applications, if this value is empty, the default value is false.

false

AppName

string

No

The application name.

The maximum length is 64 characters. Only letters, digits, periods (.), underscores (_), and hyphens (-) are allowed.

myapp

ProtocolVersion

string

No

The OAuth protocol version of the application. Valid values:

  • 2.0: OAuth 2.0 protocol.

  • 2.1: OAuth 2.1 protocol.

Default value: 2.0.

2.0

Response elements

Element

Type

Description

Example

object

Application

object

The application information.

AccessTokenValidity

integer

The validity period of the access token. Unit: seconds.

3600

AccountId

string

The Alibaba Cloud account ID to which the application belongs.

177242285274****

AppId

string

The application ID.

472457090344041****

AppName

string

The application name.

myapp

AppType

string

The application type.

WebApp

AssignmentType

string

The application assignment type. Valid values:

  • AllowAll: assigns the application to all RAM users and roles in the account, allowing them to use the application.

  • OnDemand: assigns the application only to specified RAM users and roles in the account, allowing only them to use the application.

AllowAll

CreateDate

string

The creation time.

Format: RFC 3339 (UTC). Example: 2020-10-23T08:06:57Z.

2020-10-23T08:06:57Z

DelegatedScope

object

The application scope information.

PredefinedScopes

object

PredefinedScope

array<object>

The application scope information.

object

The application scope information.

Description

string

The scope description.

Obtain the OpenID of the user. This is the default permission that you cannot remove.

Name

string

The scope name.

openid

Required

boolean

Specifies whether this scope is required by default when the application is installed. Valid values:

  • true: Required.

  • false: Not required.

The openid scope is required by default.

true

DisplayName

string

The display name of the application.

myapp

IsMultiTenant

boolean

Indicates whether the application can be installed by other accounts.

true

NeedPrincipalConsent

boolean

Specifies whether user authorization is required. Valid values:

  • true: User authorization is required.

  • false: User authorization is not required.

true

ProtocolVersion

string

The OAuth protocol version of the application. Valid values:

  • 2.0: OAuth 2.0 protocol.

  • 2.1: OAuth 2.1 protocol.

2.0

RedirectUris

object

RedirectUri

array

The redirect URI.

string

The redirect URI.

https://www.example.com

RefreshTokenValidity

integer

The validity period of the refresh token. Unit: seconds.

7776000

SecretRequired

boolean

Indicates whether an application secret is required.

true

UpdateDate

string

The update time.

Format: RFC 3339 (UTC). Example: 2020-10-23T08:06:57Z.

2020-10-23T08:06:57Z

RequestId

string

The request ID.

6616F09B-2768-4C11-8866-A8EE4C4A583E

Examples

Success response

JSON format

{
  "Application": {
    "AccessTokenValidity": 3600,
    "AccountId": "177242285274****",
    "AppId": "472457090344041****",
    "AppName": "myapp",
    "AppType": "WebApp",
    "AssignmentType": "AllowAll",
    "CreateDate": "2020-10-23T08:06:57Z",
    "DelegatedScope": {
      "PredefinedScopes": {
        "PredefinedScope": [
          {
            "Description": "Obtain the OpenID of the user. This is the default permission that you cannot remove.",
            "Name": "openid",
            "Required": true
          }
        ]
      }
    },
    "DisplayName": "myapp",
    "IsMultiTenant": true,
    "NeedPrincipalConsent": true,
    "ProtocolVersion": "2.0",
    "RedirectUris": {
      "RedirectUri": [
        "https://www.example.com"
      ]
    },
    "RefreshTokenValidity": 7776000,
    "SecretRequired": true,
    "UpdateDate": "2020-10-23T08:06:57Z"
  },
  "RequestId": "6616F09B-2768-4C11-8866-A8EE4C4A583E"
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.