Skip to content

OAuthGrant

Authorization granted by an account to an OAuth application. Deleting it signs the application out.

This object can be configured from the WebUI under Account › Credentials › Connected Applications

Type: Id<Account> · read-only

Identifier for the account that granted the authorization

Type: String · server-set

Identifier of the OAuth client that received the authorization

Type: String? · server-set

Name of the application, as provided by the client or its administrator

Type: OAuthClientKind · server-set

How the application was registered. Dynamically registered applications and Client ID Metadata Documents are not verified by an administrator.

Type: Set<OAuthScope> · server-set

Services the application was given access to. First-party applications have full access to the account.

Type: IpAddr? · server-set

IP address from which the authorization was granted

Type: UTCDateTime · server-set

Date the authorization was granted

Type: UTCDateTime · server-set

Date the application last renewed its access

The OAuthGrant object is available via the urn:stalwart:jmap capability.

This is a standard Foo/get method as defined in RFC 8620, Section 5.1.

This method requires the sysOAuthGrantGet permission.

Terminal window
curl -X POST https://mail.example.com/jmap/ \
-H 'Authorization: Bearer $TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"methodCalls": [
[
"x:OAuthGrant/get",
{
"ids": [
"id1"
]
},
"c1"
]
],
"using": [
"urn:ietf:params:jmap:core",
"urn:stalwart:jmap"
]
}'

This is a standard Foo/set method as defined in RFC 8620, Section 5.3.

Supports the destroy operation only.

This method requires the sysOAuthGrantDestroy permission.

Terminal window
curl -X POST https://mail.example.com/jmap/ \
-H 'Authorization: Bearer $TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"methodCalls": [
[
"x:OAuthGrant/set",
{
"destroy": [
"id1"
]
},
"c1"
]
],
"using": [
"urn:ietf:params:jmap:core",
"urn:stalwart:jmap"
]
}'

This is a standard Foo/query method as defined in RFC 8620, Section 5.5.

This method requires the sysOAuthGrantQuery permission.

Terminal window
curl -X POST https://mail.example.com/jmap/ \
-H 'Authorization: Bearer $TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"methodCalls": [
[
"x:OAuthGrant/query",
{
"filter": {
"accountId": "id1"
}
},
"c1"
]
],
"using": [
"urn:ietf:params:jmap:core",
"urn:stalwart:jmap"
]
}'

The x:OAuthGrant/query filter argument accepts the following conditions (combinable with AnyOf / AllOf / Not per RFC 8620):

ConditionKind
accountIdid of Account

stalwart-cli wraps the same JMAP calls. See the CLI reference for installation, authentication, and general usage.

Terminal window
stalwart-cli get OAuthGrant id1
Terminal window
stalwart-cli query OAuthGrant
stalwart-cli query OAuthGrant --where accountId=id1
Terminal window
stalwart-cli delete OAuthGrant --ids id1
ValueLabel
registeredRegistered by an administrator
dynamicRegistered dynamically (unverified)
metadataDocumentClient ID Metadata Document (unverified)
firstPartyWeb application of this server
ValueLabel
mailMail (IMAP, POP3, SMTP submission, ManageSieve, JMAP Mail)
contactsContacts (CardDAV, JMAP Contacts)
calendarsCalendars (CalDAV, JMAP Calendars)
filesFiles (WebDAV, JMAP File Storage)