|
| 1 | +--- |
| 2 | +layout: default |
| 3 | +title: Reset password API |
| 4 | +published: true |
| 5 | +--- |
| 6 | + |
| 7 | +## Request reset password link and token |
| 8 | + |
| 9 | +This call initiates the password reset process by sending a reset password |
| 10 | +link and token to the user's registered email address. User can click the link from the email |
| 11 | +and set a new password in the Mission Portal or invalidate the request. |
| 12 | +Every request has an expiration time equal to 48 hours. |
| 13 | + |
| 14 | +**URI:** https://hub.cfengine.com/api/auth/password/forgot/:username |
| 15 | + |
| 16 | +**Method:** POST |
| 17 | + |
| 18 | +**Example request (curl):** |
| 19 | + |
| 20 | +```console |
| 21 | +curl -X POST \ |
| 22 | + https://hub.cfengine.com/api/auth/password/forgot/admin |
| 23 | +``` |
| 24 | + |
| 25 | +**Successful response example:** |
| 26 | + |
| 27 | +``` |
| 28 | +HTTP 200 Ok |
| 29 | +
|
| 30 | +Reset password email successfully sent. |
| 31 | +``` |
| 32 | + |
| 33 | +**Responses:** |
| 34 | + |
| 35 | +| HTTP response code | Description | |
| 36 | +|--------------------------|---------------------------------------------------------------| |
| 37 | +| 200 OK | Check your email for the link to reset your password. | |
| 38 | +| 422 Unprocessable Entity | We are unable to reset the password at this time. | |
| 39 | + |
| 40 | + |
| 41 | +## Reset password by token |
| 42 | + |
| 43 | +This call provides possibility to change password by reset password token |
| 44 | +from the [Request reset password link and token][Reset password API#Request reset password link and token] endpoint. |
| 45 | + |
| 46 | +**URI:** https://hub.cfengine.com/api/auth/password/reset/:token |
| 47 | + |
| 48 | +**Method:** POST |
| 49 | + |
| 50 | +**Example request (curl):** |
| 51 | + |
| 52 | +```console |
| 53 | +curl -X POST \ |
| 54 | + --data-raw '{"password": "new password"}' \ |
| 55 | + https://hub.cfengine.com/api/auth/password/reset/v1twknmrLWos |
| 56 | +``` |
| 57 | + |
| 58 | +**Successful response example:** |
| 59 | + |
| 60 | +``` |
| 61 | +HTTP 200 Ok |
| 62 | +
|
| 63 | +Reset password email successfully sent. |
| 64 | +``` |
| 65 | + |
| 66 | +**Responses:** |
| 67 | + |
| 68 | +| HTTP response code | Description | |
| 69 | +|--------------------------|-----------------------------------------------------------------| |
| 70 | +| 200 OK | Password successfully changed. | |
| 71 | +| 422 Unprocessable Entity | Password validation error or the request cannot be processed. | |
| 72 | +| 429 Too Many Requests | We have detected multiple unsuccessful reset password attempts. | |
| 73 | + |
| 74 | + |
| 75 | +## Invalidate reset password token |
| 76 | + |
| 77 | +This call provides possibility to invalidate reset password token |
| 78 | +from the [Request reset password link and token][Reset password API#Request reset password link and token] endpoint. |
| 79 | + |
| 80 | +**URI:** https://hub.cfengine.com/api/auth/password/reset/:token |
| 81 | + |
| 82 | +**Method:** DELETE |
| 83 | + |
| 84 | +**Example request (curl):** |
| 85 | + |
| 86 | +```console |
| 87 | +curl -X DELETE https://hub.cfengine.com/api/auth/password/reset/v1twknmrLWos |
| 88 | +``` |
| 89 | + |
| 90 | +**Successful response example:** |
| 91 | + |
| 92 | +``` |
| 93 | +HTTP 202 Accepted |
| 94 | +
|
| 95 | +Reset password token successfully invalidated. |
| 96 | +``` |
| 97 | + |
| 98 | +**Responses:** |
| 99 | + |
| 100 | +| HTTP response code | Description | |
| 101 | +|--------------------------|------------------------------------------------| |
| 102 | +| 202 Accepted | Reset password token successfully invalidated. | |
| 103 | +| 422 Unprocessable Entity | Unable to process request. | |
0 commit comments