Skip to content

feat: use the new logout endpoint (v4-apps)#4170

Draft
framitdavid wants to merge 1 commit into
mainfrom
feat/use-the-new-logout-endpoint-a3
Draft

feat: use the new logout endpoint (v4-apps)#4170
framitdavid wants to merge 1 commit into
mainfrom
feat/use-the-new-logout-endpoint-a3

Conversation

@framitdavid
Copy link
Copy Markdown
Contributor

@framitdavid framitdavid commented May 5, 2026

Description

Switches the "Logg ut"-link in the app header from the legacy Altinn 2 endpoint to the new Altinn 3 platform endpoint.

  • Before: https://{altinnHost}/ui/authentication/LogOut
  • After: https://platform.{altinnHost}/authentication/api/v1/logout

Changes

  • src/utils/urls/urlHelper.tslogoutUrlAltinn(host) now builds the URL against the platform host (platform.<env>.altinn.<no|cloud>) and uses extractAltinnHost directly. Local-environment fallback (http://local.altinn.cloud[:port]/) and the undefined return for unknown hosts are unchanged.
  • src/utils/urls/urlHelper.test.ts — Updated expected URLs for logoutUrlAltinn across prod / TT02 / AT21 / YT01.

The single callsite (src/components/presentation/AppHeader/AppHeaderMenu.tsx) is untouched — it consumes logoutUrlAltinn(window.location.host) and picks up the new URL automatically.

Resulting URLs per environment

Host the app runs on Logout URL
*.apps.altinn.no (prod) https://platform.altinn.no/authentication/api/v1/logout
*.apps.tt02.altinn.no (TT02) https://platform.tt02.altinn.no/authentication/api/v1/logout
*.apps.at21.altinn.cloud (AT21) https://platform.at21.altinn.cloud/authentication/api/v1/logout
*.apps.yt01.altinn.cloud (YT01) https://platform.yt01.altinn.cloud/authentication/api/v1/logout
local.altinn.cloud[:port] http://local.altinn.cloud[:port]/ (unchanged)
Unknown (studio etc.) undefined (unchanged)

Related Issue(s)

Verification/QA

  • Manual functionality testing
    • I have tested these changes manually
    • Creator of the original issue (or service owner) has been contacted for manual testing (or will be contacted when released in alpha)
    • No testing done/necessary
  • Automated tests
    • Unit test(s) have been added/updated
    • Cypress E2E test(s) have been added/updated
    • No automatic tests are needed here (no functional changes/additions)
    • I want someone to help me make some tests
  • UU/WCAG (follow these guidelines until we have our own)
    • I have tested with a screen reader/keyboard navigation/automated wcag validator
    • No testing done/necessary (no DOM/visual changes)
    • I want someone to help me perform accessibility testing
  • User documentation @ altinn-studio-docs
    • Has been added/updated
    • No functionality has been changed/added, so no documentation is needed
    • I will do that later/have created an issue
  • Support in Altinn Studio
    • Issue(s) created for support in Studio
    • This change/feature does not require any changes to Altinn Studio
  • Sprint board
    • The original issue (or this PR itself) has been added to the Team Apps project and to the current sprint board
    • I don't have permissions to do that, please help me out
  • Labels
    • I have added a kind/* and backport* label to this PR for proper release notes grouping
    • I don't have permissions to add labels, please help me out

Summary by CodeRabbit

  • Bug Fixes
    • Updated logout endpoint configuration to use new authentication API endpoints across all environments (TT/AT/YT/Prod).

@framitdavid framitdavid added the backport This PR should be cherry-picked onto older release branches label May 5, 2026
@framitdavid framitdavid moved this to 🔎 In review in Team Altinn Studio May 5, 2026
@framitdavid framitdavid added squad/utforming Issues that belongs to the named squad. kind/other Pull requests containing chores/repo structure/other changes labels May 5, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 5, 2026

📝 Walkthrough

Walkthrough

The logoutUrlAltinn() function is refactored to detect localhost using isLocalEnvironment() and construct logout endpoints via extractAltinnHost(), building URLs as https://platform.${altinnHost}/authentication/api/v1/logout instead of the legacy /ui/authentication/LogOut pattern. Tests are updated to match the new endpoint structure and hostnames.

Changes

Logout Endpoint Migration

Layer / File(s) Summary
Core Implementation
src/utils/urls/urlHelper.ts
logoutUrlAltinn() replaces host.match(localRegex) with isLocalEnvironment(host) for localhost detection, removes returnBaseUrlToAltinn() usage, and builds logout URLs as https://platform.${altinnHost}/authentication/api/v1/logout via extractAltinnHost().
Tests
src/utils/urls/urlHelper.test.ts
Test assertions updated to expect /authentication/api/v1/logout endpoints under https://platform.<env>/ hostnames for TT, AT, YT, and Prod environments.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat: use the new logout endpoint (v4-apps)' clearly and concisely summarizes the main change: updating the logout endpoint implementation for v4 apps.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The pull request description is comprehensive and follows the template structure with all required sections properly completed.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/use-the-new-logout-endpoint-a3

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 5, 2026

@framitdavid
Copy link
Copy Markdown
Contributor Author

/publish

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 12, 2026

PR release:

  • <link rel="stylesheet" type="text/css" href="https://altinncdn.no/toolkits/altinn-app-frontend/4.29.2-pr.5073.use-the-new-logout-endpoint-a3.60383919/altinn-app-frontend.css">
  • <script src="https://altinncdn.no/toolkits/altinn-app-frontend/4.29.2-pr.5073.use-the-new-logout-endpoint-a3.60383919/altinn-app-frontend.js"></script>

⚙️ Building...
✅ Done!

@framitdavid
Copy link
Copy Markdown
Contributor Author

Denne avventer avklaring før vi kan merge, blir logget ut i tt02, men får too-many-redirects feil også.

@framitdavid framitdavid marked this pull request as draft May 12, 2026 14:06
@framitdavid framitdavid moved this from 🔎 In review to ⚠️ Blocked in Team Altinn Studio May 13, 2026
@framitdavid
Copy link
Copy Markdown
Contributor Author

Denne er blokkert til Team autorisasjon får sett på hvorfor vi ender opp i en evig loop mellom A2 og A3 redirection. Vi har en pågående tråd på intern Slack.

@framitdavid framitdavid self-assigned this May 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport This PR should be cherry-picked onto older release branches kind/other Pull requests containing chores/repo structure/other changes squad/utforming Issues that belongs to the named squad.

Projects

Status: ⚠️ Blocked

Development

Successfully merging this pull request may close these issues.

2 participants