Help

Integration

ByteStash OIDC Integration

Updated 18 Nov 2026 9 min read

This document explains how to implement Monosign with ByteStash, the open source self-hosted application to store and share code snippets. It covers Single Sign-On with OpenID Connect (OIDC). ByteStash supports any OpenID Connect provider; there is no single sign-on screen in the ByteStash interface, it is configured with environment variables. ByteStash uses the Authorization Code flow with PKCE, so the OIDC/OpenID access key of Monosign is used. Before you continue, it is better to read the ByteStash documentation (opens in a new tab).

This configuration was tested with ByteStash 1.6.2 (Docker image ghcr.io/jordan-dalby/bytestash, published over HTTPS behind a reverse proxy). If your version is different, please check the ByteStash documentation.

ByteStash supports OpenID Connect only. SAML is not available in ByteStash.

Monofor has no responsibility to do ByteStash configurations. If you need support please contact the ByteStash community or your ByteStash support provider.

Instructions

This documentation contains 5 main steps for integration.

  1. Creating an application on Monosign

  2. Configuring the OIDC/OpenID settings on Monosign

  3. Assign a user to the ByteStash application

  4. Configuration Single Sign-On for ByteStash

  5. Sign In Test

1- Creating an Application on Monosign

Create your application on Monosign first. Open the Applications page from the left menu and click Add New.

image-20261030-191725.png

ByteStash is not in the application catalog, so click Create from scratch.

image-20261030-191750.png

Fill in the application details on the Application tab and click Next.

image-20261118-101811.png

Property

Value

Description

Name

ByteStash

Name of the application shown to users on the Monosign portal and on the Monosign sign-in page.

Type

Web

ByteStash is accessed through a web browser. Options: Web, Mobile, Desktop, API.

Url

Optional

Leave empty or enter the address of ByteStash (for example https://<bytestash-address>).

Logo

Optional

Browse and upload a logo (PNG or JPG, max 1 MB); it is also shown on the Monosign sign-in page.

Users can see this application on their list

Enabled

Displays the application on the user portal.

On the Access tab define who can reach the application and click Create Application.

image-20261030-192040.png

Property

Value

Description

User Access Type

Only Assigned Users

Defines which users can access this application. Options: Only Assigned Users, All Users, System Default. ByteStash creates an account for every user who signs in and has no roles for SSO users, so the access is limited in Monosign.

User Group Access Type

System Default

Defines the application’s user group access.

Source Using Type

System Default

Defines which user sources the application can use.

Profile Access Type

All

Defines which user profile attributes are available to the application (Options: Restricted, All). ByteStash reads the e-mail address and the name of the user from the Monosign UserInfo endpoint.

After the application is created, click Keys and add a new Access Key for OIDC/OpenID access.

image-20261030-192203.png

Select OIDC/OpenID as the key type and click Create. Monosign generates the Client Id and Client Secret automatically. Keep Session as System Default, State as Enabled and Never Expires as Yes, or turn it off to define an expiration date for the key.

image-20261118-102034.png

Configuration details for the ByteStash application are provided as follows. They are shown on the Keys tab of the application after the key is created.

Monosign value

Example

Used in ByteStash as

Client Id

<client-id>

OIDC_CLIENT_ID

Client Secret

<client-secret>

OIDC_CLIENT_SECRET

Issuer

https://<monosign-host>/

OIDC_ISSUER_URL. Enter the address with the slash at the end; it is the address of the Configuration Url without .well-known/openid-configuration. ByteStash reads the other endpoints from it.

2- Configuring the OIDC/OpenID Settings on Monosign

Open the Keys tab of the application and click the Configure button of the OpenID Connect (OIDC) key to open the OIDC/OpenID settings.

image-20261031-211438.png

On the OIDC/OpenID Settings tab enter the scopes in the Scope field, add the callback address of ByteStash to Allowed Redirect URIs and press Update.

image-20261118-104357.png

Property

Value

Description

Allowed Redirect URIs

https://<bytestash-address>/api/auth/oidc/callback

The address where Monosign sends the user back after sign-in. The path is fixed by ByteStash; the address is built from PUBLIC_URL (step 4) and must match it exactly.

Scope

openid profile email

Enter the three scopes one by one (for multiple scopes use space as delimiter). They are the scopes ByteStash requests (OIDC_SCOPES).

Other fields

Empty / default

The other fields (Issuer, Audience, Resource, token lifetimes, CORS) are not needed.

To make the sign-out work, also add the logout address of ByteStash to the application. Open the application settings (Edit), go to the Login tab, enter the address in Allowed Redirect Urls for Logout and click Save.

Property

Value

Description

Allowed Redirect Urls for Logout

https://<bytestash-address>/auth/logout_callback

When the user signs out, ByteStash asks Monosign to end the session and to send the browser back to this address. Monosign accepts only the addresses that are listed here.

3- Assign a User to the ByteStash Application

Open the application in Monosign, click the Assignments tab and click Assign a User.

image-20261030-193315.png

Search and select the users who can sign in to ByteStash, check the Expiration Date and save. You can select more than one user.

image-20261030-193652.png

4- Configuration Single Sign-On for ByteStash

As we mentioned at the start, please check out the ByteStash documentation first. ByteStash is configured with environment variables. In the Docker Compose deployment add the following variables to the environment section of the ByteStash service:

environment:
      PUBLIC_URL: "https://<bytestash-address>"
      OIDC_ENABLED: "true"
      OIDC_DISPLAY_NAME: "Monosign"
      OIDC_ISSUER_URL: "https://<monosign-host>/"
      OIDC_CLIENT_ID: "<client-id>"
      OIDC_CLIENT_SECRET: "<client-secret>"
      OIDC_SCOPES: "openid profile email"
      ALLOW_NEW_ACCOUNTS: "true"
      DISABLE_INTERNAL_ACCOUNTS: "false"
      # Only if the Monosign certificate is issued by your own CA:
      NODE_EXTRA_CA_CERTS: "/certs/monosign-ca.crt"

Variable

Value

Description

PUBLIC_URL

https://<bytestash-address>

The address users open ByteStash at. The callback and logout addresses are built from it, so it must match the addresses in Monosign (step 2). Set it when ByteStash runs behind a reverse proxy.

OIDC_ENABLED

true

Enables the OpenID Connect sign-in.

OIDC_DISPLAY_NAME

Monosign

Shown on the sign-in button (Sign in with Monosign).

OIDC_ISSUER_URL

https://<monosign-host>/

Issuer address of Monosign with the slash at the end. ByteStash compares it with the issuer of the ID token.

OIDC_CLIENT_ID / OIDC_CLIENT_SECRET

Client Id / Client Secret

Copied from the Monosign OIDC/OpenID Access Key created in the first step. ByteStash detects the client authentication method automatically (client_secret_post with Monosign).

OIDC_SCOPES

openid profile email

Optional; this is the default value. openid is always requested.

ALLOW_NEW_ACCOUNTS

true

ByteStash creates the account at the first sign-in. When it is false, only the very first user can be created; other new Monosign users are rejected.

DISABLE_INTERNAL_ACCOUNTS

false

Keeps the local user name and password sign-in next to the SSO button. Set it to true to allow only the single sign-on.

NODE_EXTRA_CA_CERTS

Path of the CA certificate

Optional. Needed only when the certificate of Monosign is issued by your own CA or is self-signed. Mount the certificate into the container and point the variable to it.

Recreate the container so the new variables are used:

docker compose up -d

On startup ByteStash writes to its log whether it could reach Monosign (docker compose logs bytestash). A working configuration logs OIDC ready: issuer https://<monosign-host>/ ... together with the redirect and post-logout redirect addresses that have to be registered in Monosign (step 2). When ByteStash runs behind a reverse proxy without PUBLIC_URL and the proxy does not send the X-Forwarded-Proto header, the callback address is built with http and does not match the address in Monosign.

The compose file contains the client secret. Restrict its permissions (for example keep the secret in an .env file with chmod 600) and do not store it in a shared repository.

5- Sign In Test

Now try to log in to ByteStash using Monosign SSO. Open a new browser window (or a private window) and type the address of ByteStash. The sign-in page shows the Sign in with Monosign button above the local password sign-in.

image-20261118-103008.png
  1. Click Sign in with Monosign once.

  2. The Monosign sign-in page opens with the text Sign in to continue to ByteStash. Log in passwordless with your QR code (Monofor Identity) or with your user name and password (Login with Password). If you are already signed in to Monosign, the page is skipped.

image-20261118-103052.png
  1. After the sign-in Monosign redirects the browser back to ByteStash (/api/auth/oidc/callback). At the first sign-in ByteStash creates the user. The ByteStash user name is created from the Monosign user: ByteStash keeps only lowercase letters and digits (max. 30 characters), so the Monosign user john.mono becomes johnmono.

  2. The user is signed in to ByteStash. The user name is shown at the top right.

image-20261118-103309.png

Administrator rights: new accounts are never administrators, also not the first one. To make a user an administrator, run the following command on the ByteStash host with the ByteStash user name; the user signs out and in again to see the Admin panel. Afterwards administrators can be managed in Admin → Users.

docker compose exec bytestash node src/scripts/admin.js grant <username>

Sign-out: when the user signs out of ByteStash, ByteStash asks Monosign to end the session and the browser returns to /auth/logout_callback.

The users that sign in through Monosign are separate ByteStash users. They are matched by the sub claim of Monosign (the Monosign user name) and are not merged with local accounts that sign in with a user name and a password.

Troubleshooting

Symptom

Cause

Solution

The Sign in with Monosign button is not shown

OIDC_ENABLED is not true or the container was not recreated.

Check the variables (step 4) and run docker compose up -d.

There was an error with the SSO configuration. Please contact your administrator.

ByteStash could not load the Monosign configuration, for example a wrong OIDC_ISSUER_URL or Monosign is not reachable from the ByteStash host.

Use https://<monosign-host>/ with the slash at the end and check that https://<monosign-host>/.well-known/openid-configuration opens from the ByteStash host.

The identity provider encountered an error or is unavailable. after returning from Monosign

The Client Id or Client Secret is wrong, the issuer does not match, or the certificate of Monosign is not trusted. The reason is written on the sign-in page and in the log.

Copy the values again from the Monosign access key (step 1). If the log shows a certificate error (for example self-signed certificate), set NODE_EXTRA_CA_CERTS (step 4).

Monosign shows a redirect URI error

The callback address does not exactly match the Allowed Redirect URIs, for example because PUBLIC_URL is missing or different.

Set PUBLIC_URL and register https://<bytestash-address>/api/auth/oidc/callback exactly (step 2).

New account registration is currently disabled on this ByteStash instance.

ALLOW_NEW_ACCOUNTS is false and the user signs in for the first time.

Set ALLOW_NEW_ACCOUNTS to true (step 4).

Authentication failed. This could be due to a cancelled login attempt or an expired session.

The sign-in was cancelled or took too long.

Try again in a new private browser window.

Signing out of ByteStash fails or returns an error

The logout address is not registered in Monosign.

Add https://<bytestash-address>/auth/logout_callback to Allowed Redirect Urls for Logout (step 2).

A user cannot sign in

The user is not assigned to the application.

Assign the user in step 3.

The Admin panel is not shown after the sign-in

New accounts are not administrators.

Grant the administrator right with the command in step 5.

After completing the configuration on ByteStash and Monosign, it is better to test in a new private browser window if the OIDC SSO doesn’t work, because old session cookies may cause errors.

Permanent link