# Wordpress as sso client Expired Nonce

**URL:** https://meta.discourse.org/t/wordpress-as-sso-client-expired-nonce/62295
**Category:** WordPress
**Created:** [May 8, 2017, 2:58pm UTC](https://meta.discourse.org/t/wordpress-as-sso-client-expired-nonce/62295 "2017-05-08T14:58:14Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![maia\_internet](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/maia_internet/32/122258_2.png) [@maia\_internet](https://meta.discourse.org/u/maia_internet)
#### Post date: [May 8, 2017, 2:58pm UTC](https://meta.discourse.org/t/wordpress-as-sso-client-expired-nonce/62295/1 "2017-05-08T14:58:15Z")

</div>

Hi all,

I’m trying to configure my wordpress to be a sso client to my discourse.

Everything seems to be configured as the howto states but when I try to ‘login with discourse’, if the user doesn’t exist it gets created, and it returns failed login ‘Expired nonce’

The details are:  
url for the wordpress : [https://aircadetcentral.net](https://aircadetcentral.net) - on one IP  
Discourse is [https://forum.aircadetcentral.net](https://forum.aircadetcentral.net) - on another IP

Latest discourse installed  
1.3.5 WP-Discourse plugin  
No other plugins installed (apart from Cornerstone)

Not multisite (although it used to be but I deleted and reinstalled as single)

all thoughts greatly received.

Thanks

DJ

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [May 8, 2017, 5:20pm UTC](https://meta.discourse.org/t/wordpress-as-sso-client-expired-nonce/62295/2 "2017-05-08T17:20:48Z")

</div>

Yes, I signed up for you site and am getting the same results, but I can’t reproduce the error in my development environment.

> [@maia\_internet](#):
>
> Not multisite (although it used to be but I deleted and reinstalled as single)

How did you do this? Have you added any redirect rules to your `.htaccess` file?

---

<div class="post-metadata">

### Author: ![maia\_internet](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/maia_internet/32/122258_2.png) [@maia\_internet](https://meta.discourse.org/u/maia_internet)
#### Post date: [May 8, 2017, 5:25pm UTC](https://meta.discourse.org/t/wordpress-as-sso-client-expired-nonce/62295/3 "2017-05-08T17:25:05Z")

</div>

thanks @simon I must admit that’s 1 file i’ve not checked yet!

I completely deleted the multisite install, and installed a fresh single site WP. I’ll see if there are any traces of the multi install in the .htaccess.

Cheers

---

<div class="post-metadata">

### Author: ![maia\_internet](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/maia_internet/32/122258_2.png) [@maia\_internet](https://meta.discourse.org/u/maia_internet)
#### Post date: [May 8, 2017, 5:26pm UTC](https://meta.discourse.org/t/wordpress-as-sso-client-expired-nonce/62295/4 "2017-05-08T17:26:49Z")

</div>

can’t see anything drastic: here’s the file:

```
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

```

seems standard to me??

I also cleared out any excess DNS entries as well yesterday, made no difference! 😉

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [May 8, 2017, 5:33pm UTC](https://meta.discourse.org/t/wordpress-as-sso-client-expired-nonce/62295/5 "2017-05-08T17:33:37Z")

</div>

Yes, that looks right.

Where is your forum hosted?

---

<div class="post-metadata">

### Author: ![maia\_internet](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/maia_internet/32/122258_2.png) [@maia\_internet](https://meta.discourse.org/u/maia_internet)
#### Post date: [May 8, 2017, 5:34pm UTC](https://meta.discourse.org/t/wordpress-as-sso-client-expired-nonce/62295/6 "2017-05-08T17:34:39Z")

</div>

it’s on my server in a KVM VPS running ubuntu and discourse is a standard docker install. The WP is on the main server running in apache

---

<div class="post-metadata">

### Author: ![maia\_internet](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/maia_internet/32/122258_2.png) [@maia\_internet](https://meta.discourse.org/u/maia_internet)
#### Post date: [May 8, 2017, 5:40pm UTC](https://meta.discourse.org/t/wordpress-as-sso-client-expired-nonce/62295/7 "2017-05-08T17:40:12Z")

</div>

and just checked, you have an account with sync’d info on the WP site ???

what on earth have I missed!?!

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [May 8, 2017, 5:45pm UTC](https://meta.discourse.org/t/wordpress-as-sso-client-expired-nonce/62295/8 "2017-05-08T17:45:28Z")

</div>

> [@maia\_internet](#):
>
> and just checked, you have an account with sync’d info on the WP site ???

That’s strange.

I have to go out for a couple of hours. I’ll look at this some more later today.

---

<div class="post-metadata">

### Author: ![maia\_internet](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/maia_internet/32/122258_2.png) [@maia\_internet](https://meta.discourse.org/u/maia_internet)
#### Post date: [May 8, 2017, 5:46pm UTC](https://meta.discourse.org/t/wordpress-as-sso-client-expired-nonce/62295/9 "2017-05-08T17:46:10Z")

</div>

thanks @simon much appreciated 🙂

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [May 9, 2017, 5:23am UTC](https://meta.discourse.org/t/wordpress-as-sso-client-expired-nonce/62295/10 "2017-05-09T05:23:04Z")

</div>

> [@maia\_internet](#):
>
> and just checked, you have an account with sync’d info on the WP site ???

Is the Discourse Username set for my account? (It’s under the Contact Info heading on the user profile page.)

---

<div class="post-metadata">

### Author: ![maia\_internet](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/maia_internet/32/122258_2.png) [@maia\_internet](https://meta.discourse.org/u/maia_internet)
#### Post date: [May 9, 2017, 5:36am UTC](https://meta.discourse.org/t/wordpress-as-sso-client-expired-nonce/62295/11 "2017-05-09T05:36:55Z")

</div>

Morning!

No, that field is blank!

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [May 9, 2017, 6:33am UTC](https://meta.discourse.org/t/wordpress-as-sso-client-expired-nonce/62295/12 "2017-05-09T06:33:14Z")

</div>

> [@maia\_internet](#):
>
> No, that field is blank!

Thanks! That gives some idea of where the error is happening.

I went through the password reset process and can now access my account on your WordPress site. When I click on the WordPress password reset email that you site is sending out, I get a ‘connection refused’ error and can only access the site by enabling a VPN. Possibly that has something to do with the problem.

---

<div class="post-metadata">

### Author: ![maia\_internet](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/maia_internet/32/122258_2.png) [@maia\_internet](https://meta.discourse.org/u/maia_internet)
#### Post date: [May 9, 2017, 6:59am UTC](https://meta.discourse.org/t/wordpress-as-sso-client-expired-nonce/62295/13 "2017-05-09T06:59:27Z")

</div>

hmmm,

that’s interesting, I wonder if the security/firewall tools are blocking the access. I’ll take a look…

but if you access the WP login page too often, too quickly you’ll get blocked anyway.

---

<div class="post-metadata">

### Author: ![maia\_internet](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/maia_internet/32/122258_2.png) [@maia\_internet](https://meta.discourse.org/u/maia_internet)
#### Post date: [May 9, 2017, 8:13am UTC](https://meta.discourse.org/t/wordpress-as-sso-client-expired-nonce/62295/14 "2017-05-09T08:13:03Z")

</div>

Hi,

tried to bypass the firewall settings and whilst it did kick in, i reset the rules and still got an Expired Nonce whilst trying to connect to Discourse.

The password reset was successful but the link to discourse returned the same with nothing showing up in the iptables output, so the IPs weren’t getting blocked.

odd…

---

<div class="post-metadata">

### Author: ![iamntz](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/iamntz/32/114670_2.png) [@iamntz](https://meta.discourse.org/u/iamntz)
#### Post date: [May 9, 2017, 4:02pm UTC](https://meta.discourse.org/t/wordpress-as-sso-client-expired-nonce/62295/15 "2017-05-09T16:02:55Z")

</div>

The problem seems to be that `CURRENT_TIMESTAMP` isn’t a valid default value for mysql \< 5.6.5, hence the nonce table can’t be created (if you looks into logs, you’ll find „invalid value for `added_on`…).

[https://dev.mysql.com/doc/refman/5.6/en/timestamp-initialization.html](https://dev.mysql.com/doc/refman/5.6/en/timestamp-initialization.html)

The shortest solution is `sudo apt-get install mysql-server-5.6`🙂

---

<div class="post-metadata">

### Author: ![maia\_internet](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/maia_internet/32/122258_2.png) [@maia\_internet](https://meta.discourse.org/u/maia_internet)
#### Post date: [May 9, 2017, 4:11pm UTC](https://meta.discourse.org/t/wordpress-as-sso-client-expired-nonce/62295/16 "2017-05-09T16:11:28Z")

</div>

thanks @iamntz,

i’m currently on MariaDB 5.5.46 does that cause an issue? and which version of MariaDB would I need?

I have found entries like this:

`aircadetcentral.net.error.log:[Tue May 09 12:54:55.683839 2017] [:error] [pid 2179] [client x.x.x.x:xx] WordPress database error Table tablename1.wp_discourse_nonce' doesn't exist for query SELECT id FROM wp_discourse_nonce WHERE added_on < DATE_SUB(NOW(), INTERVAL 600 SECOND) made by require_once('wp-admin/user-edit.php'), require_once('wp-admin/admin.php'), require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), do_action('init'), WP_Hook->do_action, WP_Hook->apply_filters, call_user_func_array, WPDiscourse\\sso\\Client->parse_request, WPDiscourse\\sso\\Client->update_user, WPDiscourse\\Nonce::get_instance, WPDiscourse\\Nonce->__construct, WPDiscourse\\Nonce->maybe_create_db, WPDiscourse\\Nonce->purge_expired_nonces, referer: https://aircadetcentral.net/wp-login.php?discourse_sso_error=expired_nonce`

in the error log!

---

<div class="post-metadata">

### Author: ![iamntz](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/iamntz/32/114670_2.png) [@iamntz](https://meta.discourse.org/u/iamntz)
#### Post date: [May 9, 2017, 4:13pm UTC](https://meta.discourse.org/t/wordpress-as-sso-client-expired-nonce/62295/17 "2017-05-09T16:13:40Z")

</div>

Up until MariaDB 10, all features used to be 1:1 matching. So MariaDB 5.5.46 is kind of the same deal as mysql 5.5.46 🙂

---

<div class="post-metadata">

### Author: ![maia\_internet](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/maia_internet/32/122258_2.png) [@maia\_internet](https://meta.discourse.org/u/maia_internet)
#### Post date: [May 9, 2017, 4:14pm UTC](https://meta.discourse.org/t/wordpress-as-sso-client-expired-nonce/62295/18 "2017-05-09T16:14:39Z")

</div>

ok, so I’d need at least mariadb 5.6.5 is that right? thanks for spooting this 🙂

---

<div class="post-metadata">

### Author: ![iamntz](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/iamntz/32/114670_2.png) [@iamntz](https://meta.discourse.org/u/iamntz)
#### Post date: [May 9, 2017, 4:16pm UTC](https://meta.discourse.org/t/wordpress-as-sso-client-expired-nonce/62295/19 "2017-05-09T16:16:57Z")

</div>

Yup, need to upgrade. _Probably_ there is a way of making this backwards compatible, but considering that 5.6 was released in 2012 i think this would be kind of useless.

---

<div class="post-metadata">

### Author: ![maia\_internet](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/maia_internet/32/122258_2.png) [@maia\_internet](https://meta.discourse.org/u/maia_internet)
#### Post date: [May 9, 2017, 4:19pm UTC](https://meta.discourse.org/t/wordpress-as-sso-client-expired-nonce/62295/20 "2017-05-09T16:19:24Z")

</div>

indeed, my mysql software is controlled by the webhosting panel software - so just looking at the path of least resistance to upgrade.

I’ll let you know when/if I solve the problem!

thanks

[Next page](https://meta.discourse.org/t/wordpress-as-sso-client-expired-nonce/62295.md?page=2)
