Skip to content

Commit 9996740

Browse files
chore: fix dingtalk formatting (#878)
1 parent 221e7bf commit 9996740

File tree

1 file changed

+55
-48
lines changed

1 file changed

+55
-48
lines changed

docs/guides/social-signin/dingtalk.mdx

Lines changed: 55 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -10,29 +10,30 @@ Follow these steps to add DingTalk as a social sign-in provider to your Ory Clou
1010
1. [Create a DingTalk OAuth app](https://open-dev.dingtalk.com/fe/app#/corp/app).
1111
2. In the created app, set the redirect URI to:
1212

13-
```shell
14-
https://<ory-cloud-project-slug>.projects.oryapis.com/self-service/methods/oidc/callback/dingtalk
15-
```
13+
```shell
14+
https://<ory-cloud-project-slug>.projects.oryapis.com/self-service/methods/oidc/callback/dingtalk
15+
```
1616

1717
<a name="mapping"></a>
18+
1819
3. Create a Jsonnet code snippet to map the desired claims to the Ory Identity schema.
1920
Specific information [DingTalk's User API](https://open.dingtalk.com/document/orgapp-server/dingtalk-retrieve-user-information) can be viewed.
2021

21-
```json
22-
local claims = std.extVar('claims');
23-
{
24-
identity: {
25-
traits: {
26-
// Allowing unverified email addresses enables account
27-
// enumeration attacks, especially if the value is used for
28-
// e.g. verification or as a password login identifier.
29-
//
30-
// Therefore we only return the email if it (a) exists by DingTalk.
31-
[if "email" in claims then "email" else null]: claims.email,
22+
```json
23+
local claims = std.extVar('claims');
24+
{
25+
identity: {
26+
traits: {
27+
// Allowing unverified email addresses enables account
28+
// enumeration attacks, especially if the value is used for
29+
// e.g. verification or as a password login identifier.
30+
//
31+
// Therefore we only return the email if it (a) exists by DingTalk.
32+
[if "email" in claims then "email" else null]: claims.email,
33+
},
3234
},
33-
},
34-
}
35-
```
35+
}
36+
```
3637

3738
```mdx-code-block
3839
import JsonnetWarning from '../../_common/jsonnetwarning.mdx'
@@ -43,43 +44,49 @@ import JsonnetWarning from '../../_common/jsonnetwarning.mdx'
4344
4. Encode the Jsonnet snippet with [Base64](https://www.base64encode.org/) or host it under an URL accessible to Ory Cloud.
4445
5. Download the Identity Service config from your Ory Cloud project and save it to a file:
4546

46-
```shell
47-
## List all available projects
48-
ory list projects
47+
```shell
48+
## List all available projects
49+
ory list projects
4950

50-
## Get config
51-
ory get identity-config <project-id> --format yaml > identity-config.yaml
52-
```
51+
## Get config
52+
ory get identity-config <project-id> --format yaml > identity-config.yaml
53+
```
5354

5455
<a name="config"></a>
56+
5557
6. Add the social sign-in provider configuration to the downloaded config. Add the Jsonnet snippet with mappings as a Base64
5658
string or provide an URL to the file.
5759

58-
```yaml
59-
selfservice:
60-
methods:
61-
oidc:
62-
enabled: true
63-
config:
64-
providers:
65-
- id: dingtalk # this is `<provider-id>` in the Authorization callback URL. DO NOT CHANGE IT ONCE SET!
66-
provider: dingtalk
67-
client_id: .... # Replace this with the OAuth2 Client ID provided by DingTalk
68-
client_secret: .... # Replace this with the OAuth2 Client Secret provided by DingTalk
69-
mapper_url: 'base64://<YOUR_BASE64_ENCODED_JSONNET_HERE>'
70-
# Alternatively, use an URL:
71-
# mapper_url: https://storage.googleapis.com/abc-cde-prd/9cac9717f007808bf17f22ce7f4295c739604b183f05ac4afb4
72-
scope:
73-
# DingTalk supports only the `openid` or `openid corpid` scopes. For a basic setup, use the `openid` scope.
74-
# To learn more about the scopes available for DingTalk, read the [related documentation](https://open.dingtalk.com/document/orgapp-server/tutorial-obtaining-user-personal-information).
75-
- openid
76-
```
60+
```yaml
61+
selfservice:
62+
methods:
63+
oidc:
64+
enabled: true
65+
config:
66+
providers:
67+
- id: dingtalk # this is `<provider-id>` in the Authorization callback URL. DO NOT CHANGE IT ONCE SET!
68+
provider: dingtalk
69+
client_id: .... # Replace this with the OAuth2 Client ID provided by DingTalk
70+
client_secret: .... # Replace this with the OAuth2 Client Secret provided by DingTalk
71+
mapper_url: 'base64://<YOUR_BASE64_ENCODED_JSONNET_HERE>'
72+
# Alternatively, use an URL:
73+
# mapper_url: https://storage.googleapis.com/abc-cde-prd/9cac9717f007808bf17f22ce7f4295c739604b183f05ac4afb4
74+
scope:
75+
# DingTalk supports only the `openid` or `openid corpid` scopes. For a basic setup, use the `openid` scope.
76+
- openid
77+
```
78+
79+
:::info
80+
81+
To learn more about the scopes available for DingTalk, read the [related documentation](https://open.dingtalk.com/document/orgapp-server/tutorial-obtaining-user-personal-information).
82+
83+
:::
7784
7885
7. Update the Ory Cloud Identity Service configuration using the file you worked with:
7986
80-
```shell
81-
ory update identity-config <project-id> --file updated_config.yaml
82-
```
87+
```shell
88+
ory update identity-config <project-id> --file updated_config.yaml
89+
```
8390

8491
## Configuration for Self-hosted Instances
8592

@@ -88,9 +95,9 @@ Follow these steps to add DingTalk as a social sign-in provider when self-hostin
8895
1. [Create a DingTalk OAuth app](https://open-dev.dingtalk.com/fe/app#/corp/app).
8996
2. Set the redirect URI to URL that follows this pattern:
9097

91-
```shell
92-
http(s)://<domain-of-ory-kratos>:<public-port>/self-service/methods/oidc/callback/dingtalk
93-
```
98+
```shell
99+
http(s)://<domain-of-ory-kratos>:<public-port>/self-service/methods/oidc/callback/dingtalk
100+
```
94101

95102
3. Create a [Jsonnet code snippet to map the desired claims to the Ory Identity schema](#mapping).
96103
4. Encode the Jsonnet snippet with [Base64](https://www.base64encode.org/) or store it in a location available to your Ory Kratos

0 commit comments

Comments
 (0)