I am using
<script type="text/discourse-plugin" version="0.8.9"> in my instance’s
<head> and it provides me access to the
api object. What I can’t figure out however, is how to generate a nonce with it.
I’m detecting whether the visitor is logged into discourse or not, and whether they have a special cookie from the rest of my (non-discourse) site which indicates they’re logged in. If these 2 conditions are met, I do some magic to auto-log them into discourse. So far I’ve got it all working, except I have no nonce with which to create the signature that discourse needs when the user is redirected back.
With no nonce I get the error:
Verbose SSO log: Nonce has already expired
How can I use the api object to ensure a nonce gets generated for my auto-logins?