Hi, I want to configure a login flow, where users ...
# ask-a-descoper
y
Hi, I want to configure a login flow, where users login via self hosted GitHub Enterprise server. so the user will enter a domain of his server, and based on the domain I will log him in via the appropriate custom Oath app. (its something we will setup using the SDK once a customer provides us with his OAuth app id and secret). How can I do it in the flows? based on a domain he filled in previous form, use this value to select the relevant OAuth provider ? or if you have a different approach on solving this ?
✅ 1
d
Dynamic OAuth Provider Selection in Flows You can achieve this using Descope Flows with conditional logic and flow inputs. Here's the recommended approach: Flow Structure 1. Create a screen with a domain input field where users enter their GitHub Enterprise server domain 2. Use a conditional block to route users to the appropriate OAuth provider based on the domain 3. Configure multiple custom OAuth providers for different GitHub Enterprise servers
Copy code
// Example flow input structure
{
  "domain": "<http://github.company-a.com|github.company-a.com>",
  "customData": {
    "githubDomain": "<http://github.company-a.com|github.company-a.com>"
  }
}
Implementation Steps 1. Set up custom OAuth providers for each GitHub Enterprise server in the Descope Console 2. Create a flow screen with a domain input field to capture the user's GitHub Enterprise server domain 3. Add conditional logic using a Condition block to check the domain value and route to the appropriate OAuth provider Alternative Approach Using SDK You can also handle this programmatically using the Management API to dynamically create OAuth providers:
Copy code
// Create OAuth provider via Management API
const response = await descopeClient.management.oauth.create({
  name: `GitHub-${domain}`,
  clientId: customerOAuthId,
  clientSecret: customerOAuthSecret,
  authURL: `https://${domain}/login/oauth/authorize`,
  tokenURL: `https://${domain}/login/oauth/access_token`
});
Flow Inputs for Dynamic Routing Pass the domain as a flow input parameter to determine which OAuth provider to use . Flows can adapt based on context, device type, tenant, and custom parameters . Tenant-Based Approach Consider using tenants to organize customers by their GitHub Enterprise domains. Each tenant can have its own OAuth configuration, making management easier . The conditional flow approach gives you the most flexibility while keeping the user experience smooth. Users enter their domain once, and the flow automatically routes them to the correct OAuth provider. Customize OAuth Social Login | Descope Documentation The Power of Descope Flows: Enforcing SSO for SSO-Enabled Domains SSO Authentication | Descope Documentation Choosing the Right Descope UI Integration Option
y
human answer
d
I understand you'd like to speak with a human support agent. You can reach Descope support directly at support.descope.com for assistance with your GitHub Enterprise OAuth configuration question.
r
Hey Yuval, for me it sounds like you need to configure tenant level SSO where the GitHub enterprise server acts as the IdP for your customers. With this configured, we do have an email domain based redirection and the flow you are suggesting acts identically. (need to edit the login flow to add the relevant steps like "SSO enabled" check, "SSO" action, etc). it's programmatically available to configure that using the API/SDK. If you are looking for OAuth - so it's practically OIDC type in the tenant level. here is an example in node: https://github.com/descope/node-sdk?tab=readme-ov-file#manage-sso-setting let me know if you need further guidance.