# Nil secret on SSO

**URL:** https://meta.discourse.org/t/nil-secret-on-sso/121103
**Category:** Support
**Created:** [June 23, 2019, 12:46pm UTC](https://meta.discourse.org/t/nil-secret-on-sso/121103 "2019-06-23T12:46:14Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![admhpkns](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/admhpkns/32/120869_2.png) [@admhpkns](https://meta.discourse.org/u/admhpkns)
#### Post date: [June 23, 2019, 12:46pm UTC](https://meta.discourse.org/t/nil-secret-on-sso/121103/1 "2019-06-23T12:46:14Z")

</div>

I am trying to setup Discourse as an SSO provider:

> [@Use Discourse as an identity provider (SSO, DiscourseConnect)](https://meta.discourse.org/t/using-discourse-as-a-sso-provider/32974):
>
> So you want to use Discourse as an identity provider for your own web app? Great! Let’s get started. Enable [DiscourseConnect](https://meta.discourse.org/t/13045?silent=true) provider setting Under Discourse admin site settings (/admin/site\_settings) enable setting enable discourse connect provider and add a secret string to discourse connect provider secrets (used to hash SSO payloads). Implement [DiscourseConnect](https://meta.discourse.org/t/13045?silent=true) in your web app: Generate a random [nonce](https://en.wikipedia.org/wiki/Cryptographic_nonce). Let’s call this value NONCE. Save it temporarily so that you can verify it with the …

Problem is I am receiving an error, that I cannot seem to diagnose on my own.

```plaintext
$ curl http://dev.local/session/sso_provider?sso=bm9uY2U9MTExJnJldHVybl9zc29fdXJsPWh0dHA6Ly9hcGkubG9jYWwvYXV0aC9zc28%3D&sig=nmewmmiwyzhjowewztkxm2fingjjyzc4otvhmmu0odiymtqznzbizmyxyweyyjy5nmvhnmflmjfkmdyyowqyng%3D%3D

HTTP/1.1 500 Internal Server Error
...

```

The error logs show this:

```plaintext
 TypeError (no implicit conversion of nil into String) /var/www/discourse/lib/single_sign_on.rb:114:in `hexdigest' 

```

I added a secret to the settings, so I am not sure why it is saying that the secret is `nil`. What am I missing?

---

<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: [June 23, 2019, 6:04pm UTC](https://meta.discourse.org/t/nil-secret-on-sso/121103/2 "2019-06-23T18:04:26Z")

</div>

> [@admhpkns](#):
>
> I added a secret to the settings, so I am not sure why it is saying that the secret is `nil` . What am I missing?

Make sure you have added the SSO secret to the `sso provider secrets` site setting. That setting takes a list of domain/secret pairs. You can set the domain to `*` to allow the secret to be used for all domains.

If I add the secret to the `sso secret` setting, instead of the `sso provider secrets` setting, I get the error that you are reporting.

---

<div class="post-metadata">

### Author: ![admhpkns](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/admhpkns/32/120869_2.png) [@admhpkns](https://meta.discourse.org/u/admhpkns)
#### Post date: [June 23, 2019, 6:35pm UTC](https://meta.discourse.org/t/nil-secret-on-sso/121103/3 "2019-06-23T18:35:25Z")

</div>

Thanks. I thought I did that. Will check again. I’m thinking maybe a typo in the domain? Actually, what I think I did was put it in both places. Maybe that was the mistake?

Will update when I get back to a computer.

Thanks for the response.

---

<div class="post-metadata">

### Author: ![admhpkns](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/admhpkns/32/120869_2.png) [@admhpkns](https://meta.discourse.org/u/admhpkns)
#### Post date: [June 24, 2019, 10:19am UTC](https://meta.discourse.org/t/nil-secret-on-sso/121103/4 "2019-06-24T10:19:49Z")

</div>

Okay … I feel a bit embarrassed by this one. I swear I looked at the setting about 30 times to make sure I had it setup right in the Admin Settings. But, of course, it was a typo. 🤦‍♂️

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [July 24, 2019, 10:19am UTC](https://meta.discourse.org/t/nil-secret-on-sso/121103/5 "2019-07-24T10:19:53Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
