Use SSO
Single Sign-On (SSO) lets users authenticate through an external identity provider. Momen starts authorization, handles the callback, and associates the identity with an account. Profile attributes such as name or email are not synchronized to the account table automatically; process any attributes you need in an Actionflow after SSO succeeds.
Set up SSO
Add an SSO provider
Open Action → Sign in → SSO, select Add, and choose an identity provider.
Momen generates a callback URL for the configuration. You will add this URL to the provider’s OAuth or OIDC application.
Register an application with the provider
Create a Web application in the provider’s developer console and configure:
- App name, homepage, privacy policy, and terms of service
- Authorized origin, if required by the provider
- The callback URL generated by Momen
- The minimum scopes required by your app
The callback URL must exactly match the URL shown in Momen, including its scheme, host, path, and trailing slash. Do not use the published app URL as the callback URL.
Copy the client ID and client secret after creating the application. The client secret is sensitive and must not be placed in a page, client variable, or frontend code.
Complete the provider settings
Return to Momen and fill in the fields required for the selected provider, such as:
| Field | Description |
|---|---|
| clientId | Client ID generated by the provider |
| clientSecret | Client secret generated by the provider |
| scope | Requested scopes, separated as required by the provider |
| authorizationUri | Endpoint that starts user authorization |
| tokenUri | Endpoint that exchanges the authorization code for tokens |
| userInfoUri | Endpoint that returns user profile data |
| userIdAttribute | Stable profile field used as the unique identity |
The visible fields depend on the provider. Follow its OAuth/OIDC documentation and the required markers in Momen, then save and enable the SSO configuration.
Google example
For Google, create a Web application client under Google Auth Platform:
- Complete the app branding, audience, and data-access settings required by Google.
- Add the Momen callback URL under Authorized redirect URIs.
- Add the published app origin under Authorized JavaScript origins only when required by the Google client configuration.
- Copy the client ID and client secret to Momen.
- Use
email profileas the basic profile scope unless the app requires additional Google permissions.
Google requires the redirect URI in an authorization request to exactly match an authorized redirect URI. A different scheme, path, case, or trailing slash can cause redirect_uri_mismatch.
Add SSO actions
Under a page or component Trigger, choose the relevant user action:
| Action | Purpose |
|---|---|
| SSO sign-in or sign-up | Sign in an existing bound account, or create an account and bind the SSO identity |
| SSO bind | Bind an SSO identity to the currently signed-in account |
| SSO unbind | Remove the SSO identity from the current account |
SSO authorization leaves the current page and returns through a redirect. Page variables and later frontend actions from the original page do not continue. Run any required follow-up logic through an Actionflow configured for SSO success.
Process SSO profile data
Provider profile data is not synchronized to the account table automatically. To store a name, email, avatar, or another attribute:
- Add custom fields to the account table for the profile data your app needs.
- Create an Actionflow and read the SSO account ID and profile data in a Run code node.
- Inspect the provider’s actual response and expose only the fields needed by later nodes.
- Use a database Update node filtered by the account ID to write those values to the account custom fields.
- Call this Actionflow after SSO sign-in or sign-up succeeds.
Read the SSO context in a Run code node:
const accountId = context.getSsoAccountId()
const userInfo = JSON.parse(context.getSsoUserInfo())
return {
accountId,
userInfo,
}Profile shapes differ by provider. Inspect userInfo in the Actionflow logs before defining Run code outputs or database mappings. Do not assume that username, email, or another attribute is always present.
Publish and test
Publish the SSO, Actionflow, and page changes, then test the complete flow while signed out:
- Start SSO sign-in or sign-up.
- Authorize on the provider’s page.
- Confirm that the browser returns to the app and signs in.
- Verify the account binding and any custom profile fields.
- Sign in again with the same identity and confirm that no duplicate account is created.
Troubleshooting
- The provider reports a redirect mismatch: Compare the Momen callback URL and the provider configuration character by character, including scheme and trailing slash.
- Authorization completes but sign-in fails: Check the client ID, client secret, token endpoint, user-info endpoint, and unique user ID attribute.
- Sign-in works but profile data is missing: Confirm that the scope grants access to the attribute and inspect the provider’s actual
userInforesponse. - Frontend actions after SSO do not run: SSO redirects away from the page. Put required follow-up logic in the Actionflow called after SSO succeeds.
- One identity creates multiple accounts: Use the provider’s stable unique user identifier for
userIdAttribute, not a display name that can change or collide.