This document explains how to implement Monosign with Akkoma, the open source federated social network server (a fork of Pleroma). It covers Single Sign-On with OAuth 2.0, which Akkoma provides as the OAuth consumer mode based on the Ueberauth library. Akkoma uses the Authorization Code flow and reads the user from the user information endpoint, so the OIDC/OpenID access key of Monosign is used. Before you continue, it is better to read the Akkoma documentation (opens in a new tab) about the OAuth consumer mode.
This configuration was tested with Akkoma 3.20.1 and the Ueberauth strategy ueberauth_keycloak_strategy 0.4.0. If your versions are different, please check the Akkoma documentation.
OAuth 2.0 is configured in the Akkoma configuration file (config/prod.secret.exs). There is no setting screen in the Akkoma interface. Akkoma also supports LDAP; SAML is not available.
Monofor has no responsibility to do Akkoma configurations. If you need support please contact the Akkoma community or your Akkoma support provider.
The strategy must be compiled into Akkoma. The Ueberauth strategies are libraries that are added to Akkoma when it is built. Set the environment variable OAUTH_CONSUMER_STRATEGIES to keycloak:ueberauth_keycloak_strategy before you fetch the dependencies and compile Akkoma (mix deps.get and mix compile). A build without it does not offer the sign-in. The strategy needs one small correction for Monosign (step 4.2).
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 Akkoma application
Configuration Single Sign-On for Akkoma
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.
Akkoma 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 |
| Akkoma is accessed through a web browser. Options: Web, Mobile, Desktop, API. |
Url | Optional | Leave empty or enter the address of Akkoma (for example |
Logo | Optional | Browse and upload a logo; 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. |
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). Akkoma needs the e-mail address, the name and the user name of the user. |
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. Akkoma consumes the key with OAuth 2.0 and does not read the discovery document, so every address is entered one by one.
Configuration details for the Akkoma application are provided as follows:
Monosign value | Example | Used in Akkoma as |
|---|---|---|
Client Id |
|
|
Client Secret |
|
|
Auth Url |
|
|
Access Token Url |
|
|
User Info Url |
|
|
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.
Add the callback address of Akkoma to Allowed Redirect URIs, enter the scopes in the Scope field, then press Update.
Property | Value | Description |
|---|---|---|
Allowed Redirect URIs |
| The address where Monosign sends the user back after sign-in. |
Scope |
| Enter the three scopes one by one. |
Other fields | Empty / default | The other fields (Issuer, Audience, Resource, token lifetimes, CORS) are not needed. |
3- Assign a User to the Akkoma 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 Akkoma, check the Expiration Date and save. You can select more than one user. Every user needs an e-mail address, a name and a user name in Monosign.
4- Configuration Single Sign-On for Akkoma
4.1 Akkoma configuration
As we mentioned at the start, please check out the Akkoma documentation first. Akkoma uses the Ueberauth strategy Keycloak because it lets you enter every address of the provider; it works with Monosign even though Monosign is not a Keycloak server. The provider is given the name monosign so that the sign-in button and the callback address carry the name Monosign. Add the following lines to the configuration file of Akkoma, replace the placeholder values and restart Akkoma.
monosign_url = "https://<monosign-host>"
config :ueberauth, Ueberauth.Strategy.Keycloak.OAuth,
client_id: "<client-id>",
client_secret: "<client-secret>",
site: monosign_url,
authorize_url: "#{monosign_url}/openid/authorize",
token_url: "#{monosign_url}/openid/token",
userinfo_url: "#{monosign_url}/openid/userinfo",
token_method: :post
config :ueberauth, Ueberauth,
providers: [
monosign: {Ueberauth.Strategy.Keycloak, [uid_field: :email, default_scope: "openid profile email"]}
]
config :pleroma, :auth, oauth_consumer_strategies: ["monosign"]
Option | Value | Description |
|---|---|---|
client_id and client_secret | Client Id and Client Secret | Copied from the Monosign OIDC/OpenID Access Key Details created in the first step. |
site, authorize_url, token_url and userinfo_url | Monosign addresses | The Auth Url, Access Token Url and User Info Url of the Monosign key (step 1). |
providers: monosign |
| The name of the provider ( |
uid_field |
| The user information field that identifies the user in Akkoma; the e-mail address links the Monosign user to the Akkoma account. |
default_scope |
| The scopes that Akkoma requests; they must be the same as in step 2. |
oauth_consumer_strategies |
| Enables the provider; it must have the same name as the provider above. |
4.2 Correction of the token request
The Keycloak strategy sends the client credentials in the body of the token request and the library adds them again in an Authorization: Basic header. Monosign accepts the client credentials in only one place and answers with the error Multiple client credentials cannot be specified; Akkoma then shows Internal server error after the sign-in. Edit the function get_token in the file deps/ueberauth_keycloak_strategy/lib/ueberauth/strategy/keycloak/oauth.ex so that only the body is used:
def get_token(client, params, headers) do
client
|> put_param("client_id", client().client_id)
|> put_param("client_secret", client().client_secret)
|> put_param("grant_type", "authorization_code")
|> put_param("redirect_uri", client().redirect_uri)
|> put_header("Accept", "application/json")
# replaces: |> OAuth2.Strategy.AuthCode.get_token(params, headers)
|> merge_params(params)
|> put_headers(headers)
end
Then compile the dependency again and restart Akkoma (mix deps.compile ueberauth_keycloak_strategy --force). Repeat this correction after every mix deps.get that downloads the dependency again.
Akkoma takes the name, the user name (preferred_username) and the e-mail address of the user from the user information of Monosign. The OAuth consumer mode does not work with SameSite=Strict; keep "SameSite=Lax" in extra_cookie_attrs (the default). When Akkoma is behind a reverse proxy, the proxy must send X-Forwarded-Proto: https. Akkoma user names may contain only letters and digits (and _ and - when extended_nickname_format is on); a dot is never accepted. A Monosign user name with a dot, such as john.mono, must be changed in the registration form.
5- Sign In Test
The login page of Akkoma shows only the user name and password form. The sign-in with Monosign is offered on the authorization page that an application opens when it asks for access to an account (for example a mobile or web client of Akkoma). To test it without a client, register a test application and open its authorization address:
curl -X POST https://<akkoma-address>/api/v1/apps \ -d 'client_name=SSO Test' -d 'redirect_uris=urn:ietf:wg:oauth:2.0:oob' -d 'scopes=read' https://<akkoma-address>/oauth/authorize?client_id=<client_id from the answer>&redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=code&scope=read
Open the second address in a new browser window (or a private window). Below the user name and password form the page shows Sign in with external provider and the button Sign in with Monosign.
Click the Sign in with Monosign button once.
On the Monosign sign-in page log in passwordless with your QR code (Monofor Identity), with a Passkey or with your user name and password (Sign in with Password). If you are already signed in to Monosign, the page is skipped.
After the sign-in Monosign redirects the browser back to Akkoma (
/oauth/monosign/callback). At the first sign-in Akkoma shows the Registration Details with the nickname and the e-mail address from Monosign. Change the nickname if it contains a dot, and click Proceed as new user. To link the Monosign user to an account that already exists in Akkoma, enter its name or e-mail address and password and click Proceed as existing user.
After the registration Akkoma authorizes the application and shows the token code. At the next sign-ins Akkoma recognizes the user by the e-mail address and authorizes the application without the registration form.
Troubleshooting
Symptom | Cause | Solution |
|---|---|---|
The Sign in with Monosign button is not shown | The strategy was not compiled into Akkoma, | Set |
Monosign shows a redirect URI error | The callback address does not exactly match the Allowed Redirect URIs, for example because it starts with | Use |
Internal server error after the sign-in on Monosign; the log shows Multiple client credentials cannot be specified | The Keycloak strategy sends the client credentials twice in the token request. | Apply the correction of step 4.2. |
An error appears after returning from Monosign | The Client Id or Client Secret is wrong, or Akkoma cannot reach Monosign. | Copy the values again from the Monosign access key (step 1) and check that the Monosign addresses open from the Akkoma server. |
The registration form refuses the nickname | Akkoma nicknames cannot contain a dot (for example | Enter a nickname with letters and digits only. |
The page does not answer for a few minutes after a restart | Akkoma compiles its code again when it starts in the Docker installation. | Wait until the instance answers again before you test. |
A user cannot sign in | The user is not assigned to the application. | Assign the user in step 3. |
After completing the configuration on Akkoma and Monosign, it is better to test in a new private browser window if the OAuth 2.0 SSO doesn’t work, because old session cookies may cause errors.













