[GH-ISSUE #5744] Pass nonce into openAPI plugin #18971

Closed
opened 2026-04-15 17:42:48 -05:00 by GiteaMirror · 3 comments
Owner

Originally created by @fierysolid on GitHub (Nov 3, 2025).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/5744

Is this suited for github?

  • Yes, this is suited for github

Is your feature request related to a problem? Please describe.

When using a strict-dynamic Content Security Policy with a nonce, @scalar/api-reference gets blocked because it's not loaded with the nonce.

Describe the solution you'd like

I'd like to be able to pass the nonce into the plugin so it can attach itself to the inline script so it is not blocked by my CSP.

Describe alternatives you've considered

I tried to add the specific link to my script-src directive, but with no luck.

Additional context

No response

Originally created by @fierysolid on GitHub (Nov 3, 2025). Original GitHub issue: https://github.com/better-auth/better-auth/issues/5744 ### Is this suited for github? - [x] Yes, this is suited for github ### Is your feature request related to a problem? Please describe. When using a `strict-dynamic` Content Security Policy with a nonce, [@scalar/api-reference](https://cdn.jsdelivr.net/npm/@scalar/api-reference) gets blocked because it's not loaded with the nonce. ### Describe the solution you'd like I'd like to be able to pass the nonce into the plugin so it can attach itself to the inline script so it is not blocked by my CSP. ### Describe alternatives you've considered I tried to add the specific link to my `script-src` directive, but with no luck. ### Additional context _No response_
GiteaMirror added the lockedenhancement labels 2026-04-15 17:42:48 -05:00
Author
Owner

@better-auth-agent[bot] commented on GitHub (Nov 3, 2025):

(tag @better-auth-agent)

Hi there! Thanks for opening the issue regarding passing a nonce into the openAPI plugin for CSP compatibility. To troubleshoot this, please make sure that the nonce is properly generated and available in your server context before being injected. The plugin currently has a placeholder for nonce integration, so you can start by checking if your current configuration for the plugin allows passing custom parameters. As a next step, try updating your plugin configuration to explicitly accept the nonce value and attach it to the inline script tag. If you could share how you're generating and passing the nonce, that would be very helpful for further troubleshooting.

Could you also let us know if you are using the latest version of the plugin or if any custom modifications have been applied? tag @better-auth-agent

DiagramDiscordGitHub

Diagram Join Star

<!-- gh-comment-id:3482219885 --> @better-auth-agent[bot] commented on GitHub (Nov 3, 2025): (tag @better-auth-agent) Hi there! Thanks for opening the issue regarding passing a nonce into the openAPI plugin for CSP compatibility. To troubleshoot this, please make sure that the nonce is properly generated and available in your server context before being injected. The plugin currently has a placeholder for nonce integration, so you can start by checking if your current configuration for the plugin allows passing custom parameters. As a next step, try updating your plugin configuration to explicitly accept the nonce value and attach it to the inline script tag. If you could share how you're generating and passing the nonce, that would be very helpful for further troubleshooting. Could you also let us know if you are using the latest version of the plugin or if any custom modifications have been applied? tag @better-auth-agent <!-- bot:webhook reply v1 --> [Diagram](https://repodiagrams.s3.eu-north-1.amazonaws.com/better-auth_ultra_detailed_interactive.html) • [Discord](https://discord.gg/better-auth) • [GitHub](https://github.com/better-auth/better-auth) [![Diagram](https://img.shields.io/badge/Diagram-2b3137?style=flat-square)](https://repodiagrams.s3.eu-north-1.amazonaws.com/better-auth_ultra_detailed_interactive.html) [![Join](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&style=flat-square)](https://discord.gg/better-auth) [![Star](https://img.shields.io/badge/star-181717?logo=github&logoColor=white&style=flat-square)](https://github.com/better-auth/better-auth)
Author
Owner

@GautamBytes commented on GitHub (Nov 4, 2025):

Working on it!!

<!-- gh-comment-id:3484672448 --> @GautamBytes commented on GitHub (Nov 4, 2025): Working on it!!
Author
Owner

@better-auth-agent[bot] commented on GitHub (Nov 4, 2025):

tag @better-auth-agent

Hi there! It looks like you’re working on passing the nonce through the openAPI plugin to resolve your strict-dynamic CSP issue. As a next step, please verify that the nonce is correctly injected into the inline script generated by the plugin. You may want to review the plugin’s integration code and ensure that it accepts a nonce parameter (possibly adding one if it’s not yet supported) and attaches it to the script tag accordingly.

Are you encountering any specific errors during testing, or is there additional context that might help diagnose the issue further?

DiagramDiscordGitHub

Diagram Join Star

<!-- gh-comment-id:3484674655 --> @better-auth-agent[bot] commented on GitHub (Nov 4, 2025): tag @better-auth-agent Hi there! It looks like you’re working on passing the nonce through the openAPI plugin to resolve your strict-dynamic CSP issue. As a next step, please verify that the nonce is correctly injected into the inline script generated by the plugin. You may want to review the plugin’s integration code and ensure that it accepts a nonce parameter (possibly adding one if it’s not yet supported) and attaches it to the script tag accordingly. Are you encountering any specific errors during testing, or is there additional context that might help diagnose the issue further? <!-- bot:webhook reply v1 --> [Diagram](https://repodiagrams.s3.eu-north-1.amazonaws.com/better-auth_ultra_detailed_interactive.html) • [Discord](https://discord.gg/better-auth) • [GitHub](https://github.com/better-auth/better-auth) [![Diagram](https://img.shields.io/badge/Diagram-2b3137?style=flat-square)](https://repodiagrams.s3.eu-north-1.amazonaws.com/better-auth_ultra_detailed_interactive.html) [![Join](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&style=flat-square)](https://discord.gg/better-auth) [![Star](https://img.shields.io/badge/star-181717?logo=github&logoColor=white&style=flat-square)](https://github.com/better-auth/better-auth)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#18971