Guest User

Error Input

a guest
Nov 21st, 2025
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.16 KB | None | 0 0
  1. The `StackHandler` (automatic page) in Stack Auth does not have a simple boolean prop like `hideSignUp` to remove that specific link. The pre-built `<SignIn />` component includes it by default.
  2.  
  3. You have two options to remove it: **CSS hiding** (quickest) or building a **Custom Sign-in Page** (cleanest/official way).
  4.  
  5. ### Option 1: The CSS Method (Quickest)
  6.  
  7. Since you are using the automatic `StackHandler`, the easiest way is to hide the link using global CSS. The link is usually an anchor (`<a>`) tag at the bottom of the form.
  8.  
  9. Add this to your `globals.css` file:
  10.  
  11. ```css
  12. /* globals.css */
  13.  
  14. /* Target the link by its href attribute usually containing 'sign-up' */
  15. .stack-theme a[href*="sign-up"] {
  16. display: none !important;
  17. }
  18.  
  19. /* Alternatively, hide the entire footer text if it's just that link */
  20. .stack-theme .stack-sign-in-footer {
  21. display: none !important;
  22. }
  23. ```
  24.  
  25. *Note: You may need to inspect the element in your browser (Right Click \> Inspect) to double-check the class name if `stack-theme` isn't the exact wrapper class in your version.*
  26.  
  27. -----
  28.  
  29. ### Option 2: Custom Page (The "Official" Way)
  30.  
  31. For full control, you should tell Stack Auth to use your own page instead of the default one. This allows you to render *only* the inputs and buttons you want, effectively omitting the "Sign up" link.
  32.  
  33. **Step 1: Create a custom Sign-in page**
  34. Create a file at `app/sign-in/page.tsx`. Instead of using the monolithic `<SignIn />` component (which includes the link), compose the form using the smaller parts:
  35.  
  36. ```tsx
  37. // app/sign-in/page.tsx
  38. 'use client';
  39.  
  40. import {
  41. CredentialSignIn,
  42. OAuthButtonGroup,
  43. useStackApp
  44. } from "@stackframe/stack";
  45.  
  46. export default function CustomSignIn() {
  47. return (
  48. <div className="flex min-h-screen items-center justify-center">
  49. <div className="w-full max-w-md p-8 space-y-4 bg-white rounded shadow">
  50. <h1 className="text-2xl font-bold text-center">Sign In</h1>
  51.  
  52. {/* 1. OAuth Buttons (Google, GitHub, etc.) */}
  53. <OAuthButtonGroup />
  54.  
  55. <div className="relative flex py-2 items-center">
  56. <div className="flex-grow border-t border-gray-300"></div>
  57. <span className="flex-shrink-0 mx-4 text-gray-400">Or</span>
  58. <div className="flex-grow border-t border-gray-300"></div>
  59. </div>
  60.  
  61. {/* 2. Email/Password Form */}
  62. <CredentialSignIn />
  63.  
  64. {/* No Sign-Up link here! */}
  65. </div>
  66. </div>
  67. );
  68. }
  69. ```
  70.  
  71. **Step 2: Update your Stack Server Config**
  72. Tell Stack Auth to redirect users to your new page instead of the automatic one.
  73. Open `stack.ts` (or wherever you initialized `StackServerApp`) and add the `urls` config:
  74.  
  75. ```ts
  76. // stack.ts
  77. export const stackServerApp = new StackServerApp({
  78. tokenStore: 'nextjs-cookie',
  79. // ... other config
  80. urls: {
  81. signIn: '/sign-in', // Point to your new custom page
  82. // signUp: '/sign-up', // You can also point this elsewhere or leave it
  83. }
  84. });
  85. ```
  86.  
  87. ### Summary
  88.  
  89. * **Use CSS** if you want to keep the automatic page and just patch it visually.
  90. * **Use Option 2** if you want a properly customized page without hacky CSS selectors.
Advertisement
Add Comment
Please, Sign In to add comment