Skip to content

fix(connectors): make the sign-in redirect page work and accept URLs - #177

Merged
nixuuu merged 1 commit into
devfrom
fix/oauth-redirect-page
Nov 5, 2026
Merged

nixuuu merged 1 commit into
devfrom
fix/oauth-redirect-page

Conversation

@nixuuu

@nixuuu nixuuu commented Nov 5, 2026

Copy link
Copy Markdown
Member

After Slack sign-in, the redirect page at itsoltech.github.io/canopy/oauth/callback stayed on "Returning to Canopy…". It didn't open Canopy and showed no code to copy. The console said: "Executing inline script violates the following Content Security Policy directive 'script-src sha256-UQzX…'".

Cause: build-site.ts hashed the minified script, but the template wraps it in indentation and a ;. The browser hashes the exact text between the tags, so the hashes differed and the script never ran.

Fix

  • The build hashes the exact inline script and style bodies of the finished page. scripts/build-site.test.ts checks the built page; it fails on the old code.
  • The page shows the code to copy right away. For the desktop app it also shows an "Open Canopy" link, because a browser may refuse to open the app without a click. The automatic return still runs first.
  • The "Sign-in code" field also accepts the whole redirect address, or just its query, as well as the code. The gateway checks state exactly as before.

Copy audit (docs/copy.md §8):

  • New "Open Canopy" link.
  • The status after 3 s now names both ways back.
  • The field hint is now "Paste the code from the sign-in page, or that page's whole address."

Fixes: #162

The fixed redirect page hashed the minified script for its CSP, but the template wraps it in indentation and a semicolon, so browsers blocked the script and sign-in stopped on "Returning to Canopy…" with no way on. The build now hashes the exact text between the tags, and a test keeps the two in step.

The page also shows "Open Canopy" and the code to copy right away, since a browser may refuse to open the desktop app without a click, and the Sign-in code field accepts the whole redirect address as well as the code.

Fixes: #162
@nixuuu
nixuuu merged commit 6a9627f into dev Nov 5, 2026
9 checks passed
@nixuuu
nixuuu deleted the fix/oauth-redirect-page branch November 5, 2026 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant