# Discourse (as provider) + WP SSO nonce error

**URL:** <https://meta.discourse.org/t/discourse-as-provider-wp-sso-nonce-error/117113>\
**Category:** WordPress\
**Created:** [7 במאי,‏ 2019,‏ 7:48pm UTC](https://meta.discourse.org/t/discourse-as-provider-wp-sso-nonce-error/117113 "2019-05-07T19:48:12Z")\
**Posts on this page:** 1\
**Showing post:** 15

<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:** [24 במאי,‏ 2019,‏ 8:29pm UTC](https://meta.discourse.org/t/discourse-as-provider-wp-sso-nonce-error/117113/15 "2019-05-24T20:29:28Z")

</div>

> [@simon](#):
>
> With the default WP Engine caching enabled, I’m not having any problems logging into the site via Discourse.

It seems that when a site is created on WP Engine, page caching may not be initially setup. I revisited my site today and got the ‘expired nonce’ error when attempting to login with the `[discourse_sso_client]` shortcode from my site’s homepage.

To fix the issue, I created a custom login page and then contacted WP Engine to ask them to disable caching for my login page. I also included the following code in my theme’s `functions.php` file. This code ensures that a fresh nonce will be generated for the login attempt.

```php
add_filter('wpdc_sso_client_query', 'wpdc_custom_sso_client_query' );
function wpdc_custom_sso_client_query() {
    return wp_generate_password( 12, false );
}

```

---

_[View the full topic](https://meta.discourse.org/t/discourse-as-provider-wp-sso-nonce-error/117113)._
