You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/docs/developer-tools/sdks/backend/remix-sdk.mdx
+110Lines changed: 110 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -182,6 +182,27 @@ import { Link } from "@remix-run/react";
182
182
</Link>
183
183
```
184
184
185
+
### Redirecting after authentication
186
+
187
+
**Static redirect**
188
+
189
+
Set `KINDE_POST_LOGIN_REDIRECT_URL` in `.env` to send users to a fixed page after login.
190
+
191
+
**Dynamic redirect**
192
+
193
+
Append `post_login_redirect_url` or `returnTo` to the login/register URL for per-request redirects.
194
+
195
+
```jsx
196
+
<Link
197
+
to={{
198
+
pathname:"/kinde-auth/login",
199
+
search:"?post_login_redirect_url=/dashboard"
200
+
}}
201
+
>
202
+
Login
203
+
</Link>
204
+
```
205
+
185
206
**Sign into organizations**
186
207
187
208
To log into specific organizations you can specify the `org_code` in the search params.
@@ -340,6 +361,35 @@ export default function Dashboard() {
340
361
341
362
Use the loader example above to block unauthenticated users. To automatically redirect back to the requested route after login, include `returnTo` in the login/register link.
Pass the `headers` returned from `getKindeSession` in your loader/action responses so refresh tokens rotate automatically. You can also call `refreshTokens()` manually when you need the latest data (for example after a mutation).
- To log users into a specific organization, set `org_code` on your login/register links (as shown above).
386
445
- To create an organization from your app, link to `/kinde-auth/create_org` or use the Management API.
387
446
447
+
```tsx
448
+
// Create org via Kinde Auth route
449
+
<Link
450
+
to={{
451
+
pathname: "/kinde-auth/create_org",
452
+
search: "?org_name=Hurlstone"
453
+
}}
454
+
>
455
+
Create org
456
+
</Link>
457
+
```
458
+
459
+
If `org_code` is not specified and the user belongs to multiple organizations, they’ll be prompted to choose during login/registration.
460
+
388
461
## Self Serve Portal
389
462
390
463
Send users to the self-serve portal by linking to the portal URL returned from the [Self-serve portal API](/build/self-service-portal/self-serve-portal-for-orgs/) or by using a stored URL in your app.
@@ -393,6 +466,29 @@ Send users to the self-serve portal by linking to the portal URL returned from t
If you use a custom domain and start auth on `auth.mysite.com` but redirect back to `app.mysite.com`, set `KINDE_COOKIE_DOMAIN=.mysite.com` so cookies are available across subdomains.
When deploying to environments with dynamic URLs (for example Vercel previews), set `KINDE_SITE_URL`, `KINDE_POST_LOGOUT_REDIRECT_URL`, and `KINDE_POST_LOGIN_REDIRECT_URL` at build time to the preview URL. Wildcards are supported in Kinde callback/logout URLs if you prefer a simpler setup.
To keep Kinde allowlists up to date, you can use an M2M token with the Kinde Management API to add the preview callback/logout URLs during your deploy step (similar to the Next.js example).
551
+
442
552
## Health check
443
553
444
554
`/kinde-auth/health` exposes your configuration. The client secret is masked (only indicates if it is set correctly).
0 commit comments