# Discourse, Keycloak, SAML - is it impossible to configure?

**URL:** <https://meta.discourse.org/t/discourse-keycloak-saml-is-it-impossible-to-configure/165333>\
**Category:** SSO\
**Created:** [September 25, 2020, 8:01am UTC](https://meta.discourse.org/t/discourse-keycloak-saml-is-it-impossible-to-configure/165333 "2020-09-25T08:01:26Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![nahimov](https://avatars.discourse-cdn.com/v4/letter/n/aca169/32.png) [@nahimov](https://meta.discourse.org/u/nahimov)\
**Post date:** [September 25, 2020, 8:01am UTC](https://meta.discourse.org/t/discourse-keycloak-saml-is-it-impossible-to-configure/165333/1 "2020-09-25T08:01:27Z")

</div>

Hi!  
I’ve been doing this for almost a week, but I can’t set it up! Tried a million options! Help me please…

So, there is a test instance of Keycloak, address - `http://10.5.40.19:8081`. There I made a realm `CUBA` and a SAML client:

 ![image](https://global.discourse-cdn.com/meta/original/3X/6/e/6eafc0586a96053ce9b21c7e81896626edcca089.png)  
 ![image](https://global.discourse-cdn.com/meta/original/3X/6/3/631f8170a3b38ccc7a5d2e8f1c2050b4ef44946b.png)

As you can see from the screenshots, there is a test Discourse forum at `https://cuba-test-forum-en.demo.haulmont.com/discuss`  
According to the discourse-saml plugin documentation, the URL for connecting to SSO in my test forum will be like this - `https://cuba-test-forum-en.demo.haulmont.com/discuss/auth/saml/callback`  
[https://github.com/discourse/discourse-saml](https://github.com/discourse/discourse-saml)

SAML settings in `app.yml` file:

```plaintext
DISCOURSE_RELATIVE_URL_ROOT: /discuss

DISCOURSE_SAML_TITLE: "Example SAML"
DISCOURSE_SAML_TARGET_URL: "http://10.5.40.19:8081/auth/realms/CUBA/protocol/saml"
DISCOURSE_SAML_AUTO_CREATE_ACCOUNT: 1
DISCOURSE_SAML_CERT_FINGERPRINT: "0D:9A:46:68:6B:CA:A6:41:7A:F5:08:18:C4:01:47:33:75:AD:2C:EF"
DISCOURSE_SAML_CERT: "-----BEGIN CERTIFICATE-----
MIICmzCCAYMCBgF0wEV2uzANBgkqhkiG9w0BAQsFADARMQ8wDQYDVQQDDAZlbnNhbWwwHhcNMjAwOTI0MTMxODMxWhcNMzAwOTI0MTMyMDExWjARMQ8wDQYDVQQDDAZlbnNhbWwwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCclA1o6Q3jcpqpxHtx79nrDCBfUIHUhZP+4+wLlV+7nel7Kts5Tas6jSToeptueWxRLKadWtV5hN3ommGAN5/u61UXP1JX6c/vTkZZgS+xBO5wekCjZVnbOL2NA6n0PVq7//zinaqP6KsiUo8xKJKe1mrehVVpCUQW4a9rqzj8mTwE3t5t+X5GidvYDdqH075q47uTqO5WbiDJGPNH3qT8g07bzt5y3hTtu1aohCkAiChognRxVb1WDn35oC7Tn/1Hckbxie18tREXOha35Dq2jWAS5CyLf1pTHURpWS7JMp6cu8ZHE39hJpo6MKHkhtQgd9I6DBDoP1gTShU6eFCTAgMBAAEwDQYJKoZIhvcNAQELBQADggEBAAfJQNOygoL+Z16iLg8bA8l81Q/5VTmMFu2EKadefkHU611tZZm9D+5gug5RRHsaQn/NoL9gz1gDoUhBLgptklFHmiIIhGQmKdFeoNi5twIb6LFMe4ZhukWVlZuAfEHge0iE9M6/wQ54FYgQQ2aZjK+RnxBEaCRTxzJ/FzAjB/4Fp4DC2xQ8ceFdvnQoc8I+4K5SHIVqJdwKe44xIKLaLU/xKQcVeAe5drXPGOoDn4uBcrlDl6RstIIgkyIlp4RM0ofxOdUVj7PUo9NsxS9Zl9+MbHsydXTN8GhQFSoLW0zaXNFfAT0d7JJCR0QZAd9iP6YCJYBz3y5KjEeIREUUfTM=
-----END CERTIFICATE-----"

```

I took the certificate from here:

 ![image](https://global.discourse-cdn.com/meta/original/3X/7/4/7487ddbec4638de45fdec64312e5fdde124efb89.png)

Exported it to PKCS12:

 ![image](https://global.discourse-cdn.com/meta/original/3X/4/5/4539c4e11c26699e039122b3ca9c29ebe89fd525.png)

Imported it to KeyChain of my Macbook and exported it to PEM. In fact, it turned out the same, only with the words “BEGIN …” at the beginning and “END …” at the end.

When I try to log in using SAML, it sends me to the Keycloak page:

 ![image](https://global.discourse-cdn.com/meta/original/3X/e/e/eeb5baabeaab383e83cbf4320aeff4795155ec74.png)

But there I see an error:

 ![image](https://global.discourse-cdn.com/meta/original/3X/1/7/17169230d18b22f02250cf947d6e74afae272cce.png)

What am I doing wrong? I configured OpenID authorization, it works. But! For a number of reasons, I need to provide SAML as well.  
Very much I ask for help!

---

_[View the full topic](https://meta.discourse.org/t/discourse-keycloak-saml-is-it-impossible-to-configure/165333)._
