You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: articles/api/info.md
+15-23
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,5 @@
1
1
---
2
-
title: Auth0 APIs
3
-
description: Learn about Auth0's Management and Authentication APIs.
2
+
description: This page explains the basics of Auth0's Management and Authentication APIs.
4
3
section: apis
5
4
crews: crew-2
6
5
topics:
@@ -10,22 +9,22 @@ topics:
10
9
contentType: reference
11
10
useCase: invoke-api
12
11
---
13
-
# Auth0 APIs
14
12
15
-
Auth0 exposes the following APIs for developers to consume in their applications.
13
+
# Auth0 APIs
16
14
17
-
## Authentication API
15
+
Auth0 exposes two APIs for developers to consume in their applications:
18
16
19
-
The Authentication API exposes identity functionality for Auth0 and supported identity protocols (including <dfndata-key="openid">OpenID Connect</dfn>, OAuth, and <dfndata-key="security-assertion-markup-language">SAML</dfn>).
***Management**: Handles management of your Auth0 account, including functions related to (but not limited to):
20
19
21
-
Typically, you should consume this API through one of the Auth0 SDKs, such as [Auth0.js](/libraries/auth0js), or a library like [Lock](/libraries/lock). However, if you are building your authentication UI manually, you will need to call the Authentication API directly.
20
+
* Applications;
21
+
* Connections;
22
+
* Emails;
23
+
* Users.
22
24
23
-
Some example tasks include:
25
+
## Authentication API
24
26
25
-
* getting [tokens](/tokens) during authentication
26
-
* requesting a user's profile using an [Access Token](/tokens/access-tokens)
27
-
* exchanging [Refresh Tokens](/tokens/refresh-token) for new Access Tokens
28
-
* requesting a challenge for [multi-factor authentication (MFA)](/multifactor-authentication)
27
+
The Authentication API exposes Auth0 identity functionality, as well as those of supported identity protocols (such as <dfndata-key="openid">OpenID Connect</dfn>, OAuth, and <dfndata-key="security-assertion-markup-language">SAML</dfn>). Typically, you consume this API through one of the Auth0 SDKs, such as [Auth0.js](/libraries/auth0js) or a library like [Lock](/libraries/lock). If you are building your authentication UI manually, you will need to interface directly with the Authentication API.
<p>Explore the requests and responses for Auth0 Authentication API endpoints in your browser.</p>
37
+
<p>Learn about and use the Auth0 Authentication API in the browser.</p>
39
38
<p><a href="/auth-api">Open API Explorer</a></p>
40
39
</div>
41
40
</div>
@@ -55,14 +54,7 @@ Some example tasks include:
55
54
56
55
## Management API v2
57
56
58
-
The Management API allows you to manage your Auth0 account programmatically, so you can automate configuration of your environment. Most of the tasks you can perform in the Auth0 Management Dashboard can also be performed programmatically by using this API.
59
-
60
-
Some example tasks include:
61
-
62
-
* registering your applications and APIs with Auth0
63
-
* setting up [connections](/connections) with which your users can authenticate
64
-
*[managing users](/users)
65
-
*[linking user accounts](/link-accounts)
57
+
The Management API allows you to manage every aspect of your Auth0 account. For example, you can use the Management API to automate the configuration of your user environments or for runtime tasks such as user creation.
<p>Explore the requests and responses for Auth0 Management API endpoints in your browser.</p>
67
+
<p>Learn about and use the Auth0 Management API in the browser.</p>
76
68
<p><a href="/api/v2">Open API Explorer</a></p>
77
69
</div>
78
70
</div>
@@ -92,4 +84,4 @@ Some example tasks include:
92
84
93
85
### Management API v1 - DEPRECATED
94
86
95
-
The Management API v1 is deprecated and should not be used for new projects. If your existing application uses Management API v1, please see the [Management API v1 documentation](/api/management/v1).
87
+
The Management API v1 is deprecated and should not be used for new projects. If your existing application uses Management API v1, refer to the [Management API v1 documentation](/api/management/v1).
description: Learn how to create a rule using the Auth0 Management API. You can use rules to customize and extend Auth0's capabilities.
4
+
topics:
5
+
- mgmt-api
6
+
- rules
7
+
- extensibility
8
+
contentType:
9
+
- how-to
10
+
useCase:
11
+
- build-an-app
12
+
- call-api
13
+
- secure-api
14
+
---
15
+
# Create Rules
16
+
17
+
This guide will show you how to create [rules](/rules) using Auth0's Management API. This task can also be performed [using the Dashboard](/dashboard/guides/rules/create-rules).
18
+
19
+
1. Make a `POST` call to the [Create Rule endpoint](/api/management/v2#!/Rules/post_rules). Be sure to replace `MGMT_API_ACCESS_TOKEN`, `RULE_NAME`, `RULE_SCRIPT`, `RULE_ORDER`, and `RULE_ENABLED` placeholder values with your Management API Access Token, rule name, rule script, rule order number, and rule enabled value, respectively.
|`MGMT_API_ACCESS_TOKEN`|[Access Token for the Management API](/api/management/v2/tokens) with the <dfndata-key="scope">scope</dfn> `create:rules`. |
40
+
|`RULE_NAME`| Name of the rule you would like to create. The rule name can only contain alphanumeric characters, spaces, and hyphens; it may not start or end with spaces or hyphens. |
41
+
|`RULE_SCRIPT`| Script that contains the code for the rule. Should match what you would enter if you were [creating a new rule using the Dashboard](/dashboard/guides/rules/create-rules). |
42
+
| `RULE_ORDER` (optional) | Integer that represents the order in which the rule should be executed in relation to other rules. Rules with lower numbers are executed before rules with higher numbers. If no order number is provided, the rule will execute last.
43
+
|`RULE_ENABLED` (optional) | Boolean that represents whether the rules is enabled (`true`) or disabled (`false`). |
Fill in the required information, and click the **Create** button.
33
+
Fill in the required information and click the **Create** button.
34
34
35
35
### Signing Algorithms
36
36
37
-
When you create an API, you must select the algorithm with which your tokens will be signed. The signature is used to verify that the sender of the JWT is who it says it is and to ensure that the message wasn't changed along the way.
37
+
When you create an API you have to select the algorithm your tokens will be signed with. The signature is used to verify that the sender of the JWT is who it says it is and to ensure that the message wasn't changed along the way.
38
38
39
39
::: note
40
-
The signature is part of a JWT. If you are unfamiliar with JWT structure, please see [JSON Web Token Structure](/tokens/reference/jwt/jwt-structure).
40
+
The signature is part of a JWT. If you are not familiar with the JWT structure please refer to: [JSON Web Tokens (JWTs) in Auth0](/jwt#what-is-the-json-web-token-structure-).
41
41
:::
42
42
43
-
To create the signature, you must take the encoded header, the encoded payload, a secret, the algorithm specified in the header, and sign that. That algorithm, which is part of the JWT header, is the one you select for your API: `HS256` or `RS256`.
43
+
To create the signature part you have to take the encoded header, the encoded payload, a secret, the algorithm specified in the header, and sign that. That algorithm, which is part of the JWT header, is the one you select for your API: `HS256` or `RS256`.
44
44
45
45
-**RS256** is an [asymmetric algorithm](https://en.wikipedia.org/wiki/Public-key_cryptography) which means that there are two keys: one public and one private (secret). Auth0 has the secret key, which is used to generate the signature, and the consumer of the JWT has the public key, which is used to validate the signature.
46
46
@@ -56,47 +56,47 @@ For a more detailed overview of the JWT signing algorithms refer to: [JSON Web T
56
56
57
57
## Configure the Scopes
58
58
59
-
Once the application has been created, you will need to configure the Scopes that applications can request during authorization.
59
+
Once the application has been created you will need to configure the Scopes which applications can request during authorization.
60
60
61
-
In the settings for your API, go to the *Scopes* tab. In this section, add all four of the scopes discussed before:`read:timesheets`, `create:timesheets`, `delete:timesheets`, and `approve:timesheets`. Also add an additional scope: `batch:upload`.
61
+
In the settings for your API, go to the *Scopes* tab. In this section you can add all four of the scopes which was discussed before, namely `batch:upload`,`read:timesheets`, `create:timesheets`, `delete:timesheets`, `approve:timesheets`.
62
62
63
63
::: note
64
-
For the purposes of this document, we will only be concerned with the `batch:upload` scope because that is all that is required by the cron job. However, for the sake of completeness, we are adding the necessary scopes which will be required by future applications.
64
+
For the purposes of this document we will only be ever concerned with the `batch:upload` scope, as that is all that is required by the Cron job. For completeness sake we are however adding the necessary scopes which will be required by future applications as well.
When creating an API in the Auth0 Dashboard, a test application for the API will automatically be generated. In the Auth0 Dashboard, navigate to the [Application Section](${manage_url}/#/applications), and you will see the test application for the Timesheets API.
71
+
When creating an API in the Auth0 Dashboard, a test application for the API will automatically be generated. In the Auth0 Dashboard, navigate to the [Application Section](${manage_url}/#/applications) and you will see the test application for the Timesheets API.
72
72
73
73

74
74
75
75
Go to the settings for the application by clicking on the gear icon, and rename the application to `Timesheets import Job`.
76
76
77
-
For the cron job, you will need a Machine-to-Machine Application. The test application that was generated when the API was created was automatically configured as a Machine-to-Machine Application:
77
+
For the cron job you will need a Machine to Machine Application. This test application which was generated when the API was created was automatically configured as a Machine to Machine Application as can be seen in the screenshot below.
78
78
79
79

80
80
81
81
## Configure Application's access to the API
82
82
83
-
Finally, you must allow the application access to the Timesheets API. Go back to the configuration of the API, and select the *Machine to Machine Application* tab.
83
+
The final part of the Auth0 configuration is to allow the application access to the Timesheets API. Go back to the configuration of the API, and select the *Machine to Machine Application* tab.
84
84
85
85
You will see the **Timesheets Import Job** application listed, and it should have access to API as can be seen from the switch to the right of the application name which indicates a value of `Authorized`. If it does not indicate that the application is authorized, simply toggle the value of the switch from `Unauthorized` to `Authorized`.
You will also need to specify which scopes will be included in Access Tokens that are issued to the application when the application authorizes with Auth0.
89
+
You will also need to specify which scopes will be included in Access Tokens which are issued to the application when the application authorizes with Auth0.
90
90
91
91
Expand the settings for the application by clicking on the down arrow to the far right, and you will see the list of available scopes. The cron job will only require the `batch:upload` scope as it will simply create new timesheets based on the timesheet entries in the external system.
92
92
93
-
Once you have selected the `batch:upload` scope, save the settings by clicking the **Update** button.
93
+
Once you have selected the `batch:upload` scope you can save the settings by clicking the **Update** button.
Now that we have designed our solution and discussed the configurations needed on Auth0's side, we can proceed with the implementation part. That's what the next paragraph is all about, so keep reading!
97
+
Now that we have designed our solution and discussed the configurations needed on Auth0 side, we can proceed with the implementation part. That's what the next paragraph is all about, so keep reading!
0 commit comments