# Not able to INSERT with SQLCipher - SQLITE\_AUTH error

**URL:** <https://discuss.zetetic.net/t/not-able-to-insert-with-sqlcipher-sqlite-auth-error/6054>\
**Category:** SQLCipher\
**Created:** [August 28, 2023, 2:42pm UTC](https://discuss.zetetic.net/t/not-able-to-insert-with-sqlcipher-sqlite-auth-error/6054 "2023-08-28T14:42:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ragu89](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.zetetic.net/ragu89/32/2060_2.png) [@ragu89](https://discuss.zetetic.net/u/ragu89)\
**Post date:** [August 28, 2023, 2:42pm UTC](https://discuss.zetetic.net/t/not-able-to-insert-with-sqlcipher-sqlite-auth-error/6054/1 "2023-08-28T14:42:05Z")

</div>

### Expected Behavior

`INSERT` command in existing table working

### Actual Behavior

When I try to insert data in a table, I get an error code 23 [SQLITE\_AUTH](https://www.sqlite.org/rescode.html#:~:text=The%20SQLITE_AUTH%20error%20is%20returned,being%20prepared%20is%20not%20authorized.).

This happens only when I enable encryption with [sqlite3\_key](https://www.zetetic.net/sqlcipher/sqlcipher-api/#sqlite3_key).  
The insert command works fine otherwise with sqlite3.

### Steps to Reproduce

- Create an iOS Xcode project in Swift
- integrate SqliteCipher following the [official documentation of SQLCipher](https://www.zetetic.net/sqlcipher/ios-tutorial/)
- open the database following [this code snippet](https://pastecode.io/s/8ioyfy6n)
- create a table following [this code snippet](https://pastecode.io/s/ojn6mygp)
- try to insert an entry in that table with [this code snippet](https://pastecode.io/s/17w45bcg)

SQLCipher version: 4.5.4

---

<div class="post-metadata">

**Author:** ![sjlombardo](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.zetetic.net/sjlombardo/32/3_2.png) [@sjlombardo](https://discuss.zetetic.net/u/sjlombardo)\
**Post date:** [September 1, 2023, 1:49pm UTC](https://discuss.zetetic.net/t/not-able-to-insert-with-sqlcipher-sqlite-auth-error/6054/2 "2023-09-01T13:49:37Z")

</div>

Hello @ragu89 - apologies for the confusion. When you log into the customer [fulfillment site](https://license.zetetic.net/request-account/) to download the SQLCipher Commercial Edition trial, you will see a license key at the top of the page, something like this:

```auto
PRAGMA cipher_license = 'OmNpZD....';

```

You must execute that PRAGMA prior to set the license code. After you do that the SQLITE\_AUTH error will go away. If you have any other questions please let us know here, or via private commercial support ([support@zetetic.net](mailto:support@zetetic.net)).

---

<div class="post-metadata">

**Author:** ![ragu89](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.zetetic.net/ragu89/32/2060_2.png) [@ragu89](https://discuss.zetetic.net/u/ragu89)\
**Post date:** [September 1, 2023, 3:25pm UTC](https://discuss.zetetic.net/t/not-able-to-insert-with-sqlcipher-sqlite-auth-error/6054/3 "2023-09-01T15:25:15Z")

</div>

Thanks @sjlombardo , it’s working much better with the license code effectively…!  
🙂
