Skip to content

Commit

Permalink
Documentation page for confirming recover token
Browse files Browse the repository at this point in the history
  • Loading branch information
BrunoRosendo committed Sep 12, 2022
1 parent 24a7c81 commit c333430
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 1 deletion.
3 changes: 2 additions & 1 deletion documentation/docs-index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ module.exports = {
"auth/me",
"auth/logout",
"auth/register",
"auth/recover"
"auth/recover",
"auth/token"
]
},
};
87 changes: 87 additions & 0 deletions documentation/docs/auth/token.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
---
id: token
title: Confirm Recovery Token
sidebar_label: Confirm Recovery Token
slug: /auth/token
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

import Highlight from "../../src/highlight.js"

## Details

This endpoint is used to check if the given token is valid to recover an account.
The token can be generated by using the [recover](./recover.md) endpoint and is sent to the user by email.

**URL** : `/auth/recover/:token/confirm`

**Method** : <Highlight level="info" inline>GET</Highlight>

## Request examples

### Example 1 - Valid Token

**Code** : <Highlight level="success" inline>200 OK</Highlight>

<Tabs
defaultValue="request"
values={[
{label: 'Request', value: 'request'},
{label: 'Response', value: 'response'},
]}
>
<TabItem value="request">

```bash
/auth/recover/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6Im5pQGFlZmV1cC5wdCIsImlhdCI6MTY2MzAxMzg0OSwiZXhwIjoxNjYzMDE0NDQ5fQ.k5Z_nBpqt_Hs8JBhLH0ZXTl2-BG-utdIAUdhKXEFuFc/confirm
```

</TabItem>

<TabItem value="response">

```json
{}
```

</TabItem>
</Tabs>

### Example 2 - Invalid Token

**Code** : <Highlight level="danger" inline>403 FORBIDDEN</Highlight>

<Tabs
defaultValue="request"
values={[
{label: 'Request', value: 'request'},
{label: 'Response', value: 'response'},
]}
>
<TabItem value="request">

```bash
/auth/recover/invalid/confirm
```

</TabItem>

<TabItem value="response">

```json
{
"error_code": 3,
"errors": [
{
"msg": "invalid-token"
}
]
}
```

</TabItem>
</Tabs>

0 comments on commit c333430

Please sign in to comment.