# How to generate nonce from client-side Javascript

**URL:** <https://meta.discourse.org/t/how-to-generate-nonce-from-client-side-javascript/69767>\
**Category:** Development\
**Created:** [10 Settembre 2017, 9:52pm UTC](https://meta.discourse.org/t/how-to-generate-nonce-from-client-side-javascript/69767 "2017-09-10T21:52:56Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![ratebeer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ratebeer/32/120255_2.png) [@ratebeer](https://meta.discourse.org/u/ratebeer)\
**Post date:** [13 Settembre 2017, 1:08am UTC](https://meta.discourse.org/t/how-to-generate-nonce-from-client-side-javascript/69767/4 "2017-09-13T01:08:23Z")

</div>

In case anyone else finds this, I followed @fefrei’s advice

1. Identify that the user has logged into your site
2. Identify that the user is not currently logged into discourse
3. Send the user to discourse’s `/session/sso` page which will trigger the sso with the nonce
4. The SSO endpoint that gets the call from discourse recognizes it needs to do things automatically
5. Log the user in and provide the necessary information back to discourse to complete the flow

Its not pretty (causes the screen to flash) but it works. Thanks 👍

---

_[View the full topic](https://meta.discourse.org/t/how-to-generate-nonce-from-client-side-javascript/69767)._
