fix(providers): stop requesting unapproved Fortnox scopes that broke every connect (#1549)

PR #1541 added archive and connectfile to the Fortnox DEFAULT_SCOPES for
the voucher attachment import, but the registered Fortnox app does not
have those scopes approved in the Fortnox Developer Portal. Fortnox
rejects the authorize request with invalid_scope before login, which
broke every Fortnox connect in production within minutes of the deploy
(verified in Vercel runtime logs).

Remove the two scopes from the connect request; the attachment import
logic from #1541 stays fully intact and already degrades gracefully:
a 403 becomes PROVIDER_DOCUMENT_SCOPES_REQUIRED with a reconnect
follow-up card. Re-add the scopes once the portal registration has them
approved.

Also add charset=utf-8 to the OAuth callback HTML responses: without it
browsers render the Swedish error text as Latin-1 mojibake.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Mattsson
2026-08-13 01:40:20 +02:00
committed by GitHub
co-authored by Claude Fable 5
parent b9bf60234d
commit 98612fb0ac
4 changed files with 23 additions and 7 deletions
+6 -2
View File
@@ -541,7 +541,9 @@ export const arcimMigrationExtension: Extension = {
return new Response(html, {
status: 200,
headers: { 'Content-Type': 'text/html' },
// charset is required: without it browsers default to Latin-1 and
// render the Swedish text as mojibake (the "rätt behörigheter" bug).
headers: { 'Content-Type': 'text/html; charset=utf-8' },
})
}
@@ -622,7 +624,9 @@ export const arcimMigrationExtension: Extension = {
return new Response(html, {
status: 200,
headers: { 'Content-Type': 'text/html' },
// charset is required: without it browsers default to Latin-1 and
// render the Swedish text as mojibake (the "rätt behörigheter" bug).
headers: { 'Content-Type': 'text/html; charset=utf-8' },
})
} catch (error) {
log.error('OAuth callback exchange failed', error)