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.
Creating an application on Monosign
Configuring the OIDC/OpenID settings on Monosign
Assign a user to the ByteStash application
Configuration Single Sign-On for ByteStash
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.
ByteStash is not in the application catalog, so click Create from scratch.
Fill in the application details on the Application tab and click Next.
Property | Value | Description |
|---|---|---|
Name |
| Name of the application shown to users on the Monosign portal and on the Monosign sign-in page. |
Type |
| ByteStash is accessed through a web browser. Options: Web, Mobile, Desktop, API. |
Url | Optional | Leave empty or enter the address of ByteStash (for example |
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 |
| Displays the application on the user portal. |
On the Access tab define who can reach the application and click Create Application.
Property | Value | Description |
|---|---|---|
User Access Type |
| 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 |
| Defines the application’s user group access. |
Source Using Type |
| Defines which user sources the application can use. |
Profile Access Type |
| 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.
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.
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 Secret |
|
|
Issuer |
|
|
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.
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.
Property | Value | Description |
|---|---|---|
Allowed Redirect URIs |
| The address where Monosign sends the user back after sign-in. The path is fixed by ByteStash; the address is built from |
Scope |
| Enter the three scopes one by one (for multiple scopes use space as delimiter). They are the scopes ByteStash requests ( |
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 |
| 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.
Search and select the users who can sign in to ByteStash, check the Expiration Date and save. You can select more than one user.
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 |
| 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 |
| Enables the OpenID Connect sign-in. |
OIDC_DISPLAY_NAME |
| Shown on the sign-in button (Sign in with Monosign). |
OIDC_ISSUER_URL |
| 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 ( |
OIDC_SCOPES |
| Optional; this is the default value. |
ALLOW_NEW_ACCOUNTS |
| ByteStash creates the account at the first sign-in. When it is |
DISABLE_INTERNAL_ACCOUNTS |
| Keeps the local user name and password sign-in next to the SSO button. Set it to |
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.
Click Sign in with Monosign once.
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.
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 userjohn.monobecomesjohnmono.The user is signed in to ByteStash. The user name is shown at the top right.
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 |
| Check the variables (step 4) and run |
There was an error with the SSO configuration. Please contact your administrator. | ByteStash could not load the Monosign configuration, for example a wrong | Use |
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 |
Monosign shows a redirect URI error | The callback address does not exactly match the Allowed Redirect URIs, for example because | Set |
New account registration is currently disabled on this ByteStash instance. |
| Set |
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 |
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.












