The process for internal apps and third-party enterprise apps is similar. This topic uses an internal app as an example.
Step 1: Create an app
- Sign in to the DingTalk Developer Platform.
- Open the details page of the app you have created. On the Basic Information page, view the app’s SuiteKey/SuiteSecret (Third-party enterprise app) or AppKey/AppSecret (Internal app).
-
On the app details page, click Development Configuration > Security Settings, and enter the redirect URI (callback domain).
The redirect URI is the address you expect to be redirected to after sign-in authorization.
Step 2: OAuth sign-in authorization
To use DingTalk OpenAPI to read and write resources on behalf of a user, complete authorization through the OAuth 2.0 authorization flow. The OAuth 2.0 authorization flow is illustrated below.Use the sign-in authorization page provided by DingTalk
Construct the sign-in authorization page. The page parameters are as follows:Important
- For readability, line breaks are added to the following parameter example. Line breaks are not required in actual use.
- Parameter values must be URL-encoded. The following example has already been URL-encoded.
On success, redirects to: https://www.aaaaa.com/a/b?authCode=xxxx&state=dddd
On failure, redirects to: https://www.aaaaa.com/a/b?error=yyyyyy&state=dddd
Embedded QR Code sign-in authorization
-
Include the DingTalk Scan QR Code sign-in JSSDK in the page.
-
Call the following method where the Scan QR Code sign-in is required.
Parameter description (in TypeScript):