# Integrating Unikname Connect with Discourse

# What is Unikname Connect?

Unikname Connect is the easiest and safest authentication solution for any saas platforms and mobile apps. This solution have been designed for Saas platforms with users sensitive to the protection of their privacy, who want to be sure not to be tracked, and fleeing Facebook Connect or Sign In with Apple. Integrating Unikname Connect to your platforms will increase value proposition for your visitors, and will improve security. No more need to manage and to secure user's passwords and database!

# About Discourse

Discourse

Unikname Connect can be easily integrated within opensource frameworks compatible with the standard OAuth authorization protocol.

In this example, our discussion forum website is based on the famous open source (Discourse solution)[https://www.discourse.org]. Unikname users are automaticaly signed-in for an optimal user experience.

👉 Run this example

Table of Content

# Testing Unikname Connect with your own individual @unikname

After getting your individual @unikname, to can try it out on our partner's websites, such as:

# Registering your service

# Activation of Unikname Connect service

In order to activate Unikname Connect for your service, contact us by fill in the dedicated form.

We will contact you back as soon as possible.

# Check the received data

After being contacted by the Unikname Team, you should have the following information to go further:

  • your organization @unikname
  • the URL of the website you want to integrate with Unikname Connect
  • a pair of client_id/client_secret credentials to configure in your application
  • a coupon to get your organization @unikname

They are necessary to setup your account to display a such login screen when your clients will connect:

Example of organization @unikname on

# Your organization @unikname

Your users will see your organization @unikname when they connect on your service. For example, @Unikname-Forum above.

# The URL of your website

Your users will see your website URL when they connect on your service. For example, https://forum.unikname.com above.

# The client_id/client_secret credentials

These credentials will be necessary to configure the link between your service and Unikname Connect.

# The UNIK coupon

This information will be used to create your organization @unikname.

# Setup of your organization @unikname

To setup your organization @unikname, you first need to create it with the coupon.

Then go back here.

# Disclose your organization @unikname and verify the URL of your website

As shown before, your users will be able to check and verify information about your service. So you need to disclose and reveal them to the world.

They will be publicly readable in the UNS.network.

Use the uns CLI installed before to create your organization @unikname to disclose and verify your information:

# Disclose your @unikname

$ uns unik:disclose "@organization:MyCompany" -e "MyCompany"
Data to replace Explanation
MyCompany The @unikname you want to show to your users

# Verify your domain URL

Your domain URL will be verified in three steps:

  1. Generate a verification package.

    $ uns properties:register "@organization:MyCompany" --value "www.mycompany.com"

Data to replace Explanation
www.mycompany.com The URL of your website to verify.
⚠️ Do not include protocol. https will be used by default.

This command provides a verificationKey and write a verification package in uns-verification.txt file. It will be used in next steps.

  1. Expose the proof of ownership in your website:

In order to prove that you own your domain name, you will need to expose the generated verification package using one of the followings methods:

  • Html mode:

    Include the verificationKey in the HTML DOM of your website's landing page "https://www.mycompany.com/". The verificationKey can be placed in any html tag or in html source comments.

  • File mode:

    Upload the uns-verification.txt file to the following route of your website: "https://www.mycompany.com/.well-known/uns-verification.txt"

  1. Finalize the verification process:

Use the following command according chosen verification method. The uns-verification.txt file should be located in the directory of the command execution.

$ uns properties:verify "@organization:MyCompany" --url-channel {html, file}

This will add the "Verified/URL" property to your unik.

Thats it! You can check you information by looking for your organization @unikname in the UNS Network Explorer.

# Installation

  • Connect to your Discourse server (sorry, you can't install a plugin from the admin panel 😞)

  • Access your container’s app.yml file (it should be present in /var/discourse/containers/)

    cd /var/discourse nano containers/app.yml

Add the Discourse Unikname Connect plugin’s repository URL to your container’s app.yml file:

hooks:
  after_code:
    - exec:
        cd: $home/plugins
        cmd:
          - ...
          - sudo -E -u discourse git clone https://github.com/unik-name/discourse-unikname

(Add the plugin’s git clone url just below sudo -E -u discourse git clone https://github.com/discourse/docker_manager.git)

Rebuild the container:

cd /var/discourse
./launcher rebuild app

That’s it, you’ve successfully installed the Unikname Connect plugin on your Discourse instance!

# Setup

A an admin, go to the Discourse "burger" menu → admin → "Settings" tab → "Plugin" category.

You can also go to https://<your_discourse_forum_url> /admin/site_settings/category/plugins?filter=plugin%3Adiscourse-unikname

Then, configure the following attributes:

Attribut Description
unikname connect enabled Of course, check this box to enable Unikname Connect login for your users
unikname connect unikname key The key you have received from Unikname's support request
unikname connect secret The secret you have received from Unikname's support request
unikname connect authorize scope openid by default, or openid email if you want to ask for the user to share his email address

# Check user login

Your users should now be able to use Unikname Connect to connect to your website and to see this kind of login screen:

Discourse with Unikname Connect

# Testing the integration

Just go to your service web site and click Connect with your private @unikname or Use your private @unikname. You should see the Unikname Login screen similar to this:

Unikname Login screen

# Troubleshooting

If you’re having issues when connecting (access denied ...), first ensure the credentials (@unikname, Unikname Connect secret, client id/secret ...) you are using to connect to Unikname Connect server are the good one.

Then, check that you’re using the latest version of all OpenID Connect SDK, library, plugin or service embedded in your application.

After that, if still you need help to integrate with Unikname Connect, you can get support on the Unikname Forum.