# Chapter 18: Basic Authentication

**URL:** <https://forums.kodeco.com/t/chapter-18-basic-authentication/49761>\
**Category:** Server Side Swift with Vapor\
**Created:** [September 17, 2018, 8:42am UTC](https://forums.kodeco.com/t/chapter-18-basic-authentication/49761 "2018-09-17T08:42:52Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![axlroach](https://s3.amazonaws.com/cdn.raywenderlich.com/community/forum-assets/noun-game-ghost-878668.png) [@axlroach](https://forums.kodeco.com/u/axlroach)\
**Post date:** [September 17, 2018, 8:42am UTC](https://forums.kodeco.com/t/chapter-18-basic-authentication/49761/1 "2018-09-17T08:42:52Z")

</div>

After following the instructions down through the end of the Basic Authentication section (through to page 298), when I use RESTed to attempt to create content, I get the following response:

```
{
    "error": true,
    "reason": "No BCrypt revision information found"
}

```

I have extended my User model with BasicAuthenticatable, and I have added this to my content controller’s boot(router:):

```
    let basicAuthMiddleware = User.basicAuthMiddleware(using: BCryptDigest())
    let guardAuthMiddleware = User.guardAuthMiddleware()
    let protected = noteRoutes.grouped(basicAuthMiddleware, guardAuthMiddleware)
    
    protected.post(use: create)

```

In configure.swift, I have imported Authentication and added:  
try services.register(AuthenticationProvider())

Lastly, I have imported Authentication to both my User model and my content controller files.

Does anyone see what I’ve missed?

Thanks!

---

<div class="post-metadata">

**Author:** ![axlroach](https://s3.amazonaws.com/cdn.raywenderlich.com/community/forum-assets/noun-game-ghost-878668.png) [@axlroach](https://forums.kodeco.com/u/axlroach)\
**Post date:** [September 17, 2018, 9:32am UTC](https://forums.kodeco.com/t/chapter-18-basic-authentication/49761/2 "2018-09-17T09:32:28Z")

</div>

In case anyone else is having the same problem, I inserted my user directly into my database and did not bcrypt the password. Once I went to [https://bcrypt-generator.com/](https://bcrypt-generator.com/), and updated my user with the bcrypt version of the password, this error went away and all worked correctly.

---

<div class="post-metadata">

**Author:** ![shogunkaramazov](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/shogunkaramazov/32/108826_2.png) [@shogunkaramazov](https://forums.kodeco.com/u/shogunkaramazov)\
**Post date:** [September 17, 2018, 10:09am UTC](https://forums.kodeco.com/t/chapter-18-basic-authentication/49761/3 "2018-09-17T10:09:21Z")

</div>

@axlroach Thank you for sharing the solution - much appreciated!

---

<div class="post-metadata">

**Author:** ![tciuro](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/tciuro/32/89139_2.png) [@tciuro](https://forums.kodeco.com/u/tciuro)\
**Post date:** [March 29, 2020, 9:02pm UTC](https://forums.kodeco.com/t/chapter-18-basic-authentication/49761/4 "2020-03-29T21:02:46Z")

</div>

Just to elaborate a little on [axlroach](https://forums.kodeco.com/u/axlroach), I just hit the same issue and discovered why that happen: I had previously created users without hashing the password. So when I tried to authenticate, the error “No BCrypt revision information found” was returned, meaning “the password is not hashed”.

Solution: make sure the user’s records in the database are properly hashed. In my case, I wrote a simple “setupDummyData” function to populate the database, which entered users with a hashed password. After nuking the database (or just fix the issue manually as [axlroach](https://forums.kodeco.com/u/axlroach) points out), it all should be working fine.

I hope this helps.

---

<div class="post-metadata">

**Author:** ![shogunkaramazov](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/shogunkaramazov/32/108826_2.png) [@shogunkaramazov](https://forums.kodeco.com/u/shogunkaramazov)\
**Post date:** [April 6, 2020, 12:02pm UTC](https://forums.kodeco.com/t/chapter-18-basic-authentication/49761/5 "2020-04-06T12:02:28Z")

</div>

@tciuro Thank you for sharing this - much appreciated!
