Skip to content

Conversation

@jmikrut
Copy link
Member

@jmikrut jmikrut commented May 28, 2025

Exposes a new argument to authentication strategies which allows the author to determine if this auth strategy has the capability of setting response headers or not.

This is useful because some auth strategies may want to set headers, but in Next.js server components (AKA the admin panel), it's not possible to set headers. It is, however, possible to set headers within API responses and similar contexts.

So, an author might decide to only run operations that require setting headers (i.e. refreshing an access token) if the auth strategy is being executed in contexts where setting headers is possible.

@jmikrut jmikrut changed the title feat: adds new isAdmin prop to auth strategies feat: adds new canSetHeaders prop to auth strategies May 28, 2025
Copy link
Member

@AlessioGr AlessioGr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually found one more thing - can we default canSetHeaders to true? Or alternatively invert it (cannotSetHeaders).

I think now, a normal fetch request would incorrectly have canSetHeaders: false

Copy link
Member

@AlessioGr AlessioGr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nevermind! Just saw you added canSetHeaders: true in utilities/handleEndpoints.ts

@jmikrut jmikrut merged commit ca6f849 into main May 29, 2025
80 checks passed
@jmikrut jmikrut deleted the feat/auth-strategies-isAdmin branch May 29, 2025 13:59
@github-actions
Copy link
Contributor

🚀 This is included in version v3.40.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants