# How to setup heroku ENV variable for sso secret?

**URL:** <https://meta.discourse.org/t/how-to-setup-heroku-env-variable-for-sso-secret/63155>\
**Category:** Support\
**Tags:** unsupported-install\
**Created:** [May 22, 2017, 6:45pm UTC](https://meta.discourse.org/t/how-to-setup-heroku-env-variable-for-sso-secret/63155 "2017-05-22T18:45:13Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![railsnoob](https://avatars.discourse-cdn.com/v4/letter/r/ce73a5/32.png) [@railsnoob](https://meta.discourse.org/u/railsnoob)\
**Post date:** [May 22, 2017, 6:45pm UTC](https://meta.discourse.org/t/how-to-setup-heroku-env-variable-for-sso-secret/63155/1 "2017-05-22T18:45:13Z")

</div>

right now my code looks like:

```plaintext
require 'single_sign_on'

class DiscourseSsoController < ApplicationController
  before_action :logged_in_user 
  def sso
    secret = "ilovetomcruise"
    sso = SingleSignOn.parse(request.query_string, secret)
    sso.email = current_user.email 
    sso.name = current_user.name # this is a custom method on the User class
    sso.username = current_user.name
    sso.external_id = current_user.id 
    @user_id = current_user.id
    sso.avatar_url = current_user.photo
    sso.sso_secret = secret
    sso.avatar_force_update = true

  end
end

```

How do I create an `ENV['something_here']` with heroku so I do not show the secret in my code? thanks.

---

<div class="post-metadata">

**Author:** ![railsnoob](https://avatars.discourse-cdn.com/v4/letter/r/ce73a5/32.png) [@railsnoob](https://meta.discourse.org/u/railsnoob)\
**Post date:** [May 22, 2017, 6:47pm UTC](https://meta.discourse.org/t/how-to-setup-heroku-env-variable-for-sso-secret/63155/2 "2017-05-22T18:47:14Z")

</div>

is it just heroku config:set DISCOURSE\_SECRET= ilovetomcruise

and then

ENV[‘DISCOURSE\_SECRET’] ?

---

<div class="post-metadata">

**Author:** ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)\
**Post date:** [May 22, 2017, 6:48pm UTC](https://meta.discourse.org/t/how-to-setup-heroku-env-variable-for-sso-secret/63155/3 "2017-05-22T18:48:38Z")

</div>

I doubt it. That stuff should be configured on the Discourse web interface.

You really want to install following [these instructions](https://github.com/discourse/discourse/blob/master/docs/INSTALL-cloud.md).

---

<div class="post-metadata">

**Author:** ![railsnoob](https://avatars.discourse-cdn.com/v4/letter/r/ce73a5/32.png) [@railsnoob](https://meta.discourse.org/u/railsnoob)\
**Post date:** [May 22, 2017, 6:53pm UTC](https://meta.discourse.org/t/how-to-setup-heroku-env-variable-for-sso-secret/63155/4 "2017-05-22T18:53:15Z")

</div>

I thought that stuff goes into my Rails app? I installed with those instructions awhile ago. If everything is on the digital ocean server how will it communicate with my app?

---

<div class="post-metadata">

**Author:** ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)\
**Post date:** [May 22, 2017, 6:55pm UTC](https://meta.discourse.org/t/how-to-setup-heroku-env-variable-for-sso-secret/63155/5 "2017-05-22T18:55:07Z")

</div>

Oh. Do you mean that you have written a Rails app that you would like to SSO authenticate against? I didn’t understand that at all from your post. Sorry. I’m no help help here.

---

<div class="post-metadata">

**Author:** ![alxpck](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alxpck/32/243713_2.png) [@alxpck](https://meta.discourse.org/u/alxpck)\
**Post date:** [May 22, 2017, 7:01pm UTC](https://meta.discourse.org/t/how-to-setup-heroku-env-variable-for-sso-secret/63155/6 "2017-05-22T19:01:46Z")

</div>

Yes, as far as [setting ENV variables is concerned on Heroku](https://devcenter.heroku.com/articles/config-vars) it’s what you said earlier:

`heroku config:set DISCOURSE_SECRET=ilovetomcruise`

Once you do that, you’ll have the ENV set on your Heroku server.

---

<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:** [June 9, 2019, 2:37am UTC](https://meta.discourse.org/t/how-to-setup-heroku-env-variable-for-sso-secret/63155/9 "2019-06-09T02:37:26Z")

</div>



---

<div class="post-metadata">

**Author:** ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)\
**Post date:** [June 25, 2019, 1:24am UTC](https://meta.discourse.org/t/how-to-setup-heroku-env-variable-for-sso-secret/63155/10 "2019-06-25T01:24:54Z")

</div>


