|
| 1 | +# Next.js Demo of Edgio Token Auth Functionality |
| 2 | +This project demonstrates how Token Auth works with Edgio. For more details on this feature, visit [the docs](https://docs.edg.io/applications/v7/security/token_auth). |
| 3 | + |
| 4 | +## Available Pages |
| 5 | +This application exposes a few separate pages and one API endpoint: |
| 6 | + |
| 7 | +* Main Page `/`: This page does not require a token. |
| 8 | +* Token Auth Landing Page `/secure`: This page does not require a token. All links on this page require a valid token. |
| 9 | +* Static Secure Page `/secure/static`: This page shows static data. |
| 10 | +* Static Dynamic Page `/secure/dynamic`: This page shows dynamic data fetched from a third-party API. |
| 11 | +* Token Generator/Decoder `/secure/generator`: This page allows the visitor to create and decode `ectoken`-compatible tokens. |
| 12 | +* Current Token Information `/secure/info`: This page shows the decoded information about the token used to access the page. |
| 13 | +* API route `/api/token`: This API route takes a `GET` request and returns a new token valid for all users but only for three minutes from when it was generated. |
| 14 | + |
| 15 | +## How to Use |
| 16 | +1. Navigate to the project homepage and click the link for the "Landing Page." |
| 17 | +1. On the landing page, click the button to "Generate a temporary token." |
| 18 | +1. Copy the generated token to your clipboard. Note that the links on this page will automatically update when a token is generated. |
| 19 | +1. If you have generated a token via the client-side generator (see below), you can replace the token in the query string for any of the secure routes. |
| 20 | + |
| 21 | +## Generating a Custom Token |
| 22 | +You can also generate a custom token for this site. (Please note: the primary and backup tokens must be present in the Edgio environment variables for this feature to work properly.) |
| 23 | +1. Navigate to the "Client-side Token Generator/Decoder" page. |
| 24 | +1. Under the "Encode Token" section, enter the values you need for your token. |
| 25 | +1. In that same section, enter one of the two keys you entered in your Token Auth settings for your Edgio environment. |
| 26 | +1. Click "Encode Token." |
| 27 | +1. The "Token value" field will contain the encoded token for your environment. Copy that token, and use it when navigating the demo site. |
0 commit comments