Skip to content

Commit

Permalink
Added recipe on how to generate a random string using generateAuthent…
Browse files Browse the repository at this point in the history
…icationToken
  • Loading branch information
mpscholten committed Oct 1, 2020
1 parent b06de0f commit f155170
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Guide/recipes.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -265,3 +265,15 @@ To confirm before a link is fired add an onclick to the link.
<a href={UsersAction} onclick="if (!confirm('Do you really want to delete the internet?')) event.preventDefault();"></a>
|]
```

## How to generate a random string

To generate a random string which can be used as a secure token or hash use `generateAuthenticationToken`:

```haskell
import IHP.AuthSupport.Authentication -- Not needed if you're inside a IHP controller

do
token <- generateAuthenticationToken
-- token = "11D3OAbUfL0P9KNJ09VcUfCO0S9RwI"
```

0 comments on commit f155170

Please sign in to comment.