SaasCore Docs
  • Get Started
  • Configuration
    • Database
    • Stripe
      • Product ID and Price ID
      • API keys
      • Stripe Webhook
    • Emails
      • Cron Jobs
    • Claudinary
    • Chat plugin
    • Upstash Redis
    • OAuth with Google and GitHub
    • Subscription types and plans
    • Affiliate program
    • Google Analytics Api
  • Landing page
    • Header
    • Hero
      • Discount
      • AvatarCircles
    • Other components
  • Authentication Flow
    • For Admins
    • For Clients
      • OAuth
      • Credentials
    • For Affiliates
  • Payments
    • Payment Flow Scenarios
      • Scenario 1: Registered Client
      • Scenario 2: Direct Subscription from Home Page
      • Upgrading/Downgrading/Canceling Subscriptions
    • Pricing Table
  • Component Protection
  • Pending ...
Powered by GitBook
On this page
  1. Authentication Flow

For Affiliates

If you understand the authentication flow for clients, this will be straightforward because it’s essentially identical.

It's like setting up a free account for a client (as described in Scenario 1) but with a different role, "AFFILIATE," which is passed from the sign-up page to the backend.

Process:

  1. Sign-Up: On the sign-up page, select the option to sign up as an affiliate.

  2. Backend Handling:

    • When the account creation request is sent to the backend, the role AFFILIATE is assigned during the setupUserAccount() function.

    await prisma.user.update({
        where: { id: userId },
        data: {
            roles: {
                set: ["AFFILIATE"],
            },
        },
    });
    
    handleAfterSignupTasks({
        email,
        name,
        userId,
        isAffiliate,
    });

For further queries or assistance, refer to the code comments or contact our support team.

PreviousCredentialsNextPayments

Last updated 10 months ago