NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
A JS userscript that streamlines working with the Middleware's Swagger UI: it fetches and auto-renews auth tokens for pre-configured users, authorizes both the Bearer and Basic schemes in one click, and removes repetitive friction from the endpoint UI (auto "Try it out", hidden example schemas, live-response-only view).
All authorization is done through Swagger UI's own Redux store, so it stays in sync with the native dialog and keeps working whether the dialog is open or closed. The tool also allows manual operations with Basic and Bearer tokens.
First install a userscript manager such as Tampermonkey. Then install the script using one of the methods below.
One-click install and automatic updates:
Open that URL with the userscript manager installed; it will prompt you to install. Updates are then delivered automatically by your userscript manager.
For those who prefer not to use OpenUserJS:
Swagger_UI_Middleware_Dev_Tools.user.js.Note: with a manual install you won't get automatic updates; re-paste the latest version to upgrade.
Chrome (and Chromium-based browsers: Edge, Brave, Opera, Arc...)
Once permissions are set:
Swagger UI Middleware Dev Tools v3.1.1 initialised. Enabled: true.Configuration is done in the app, not by editing the script (so updates never overwrite it). On first run with no saved config, the Configuration dialog opens automatically. You can also open it any time via:
The dialog shows a JSON blob you edit directly:
{
"users": [
{ "username": "you@example.com", "password": "your-password" }
],
"domains": {
"TST": "https://authorization.proconnect.tst.publicis.com",
"DEV": "https://authorization.proconnect.dev.publicis.com",
"LOCAL": "https://authorization.proconnect.dev.publicis.com"
},
"tokenEndpoint": "/api/authorization/users/token",
"fullTokenTtl": 2700,
"renewalPostExpiryBufferSecs": 5,
"showMainPageBanner": false,
"usersSearchEndpoint": "/api/users/search",
"customClaimTokenEndpoint": "/api/authorization/users/{referenceIdentityId}/token",
"customClaim": {
"application": "string",
"businessGroups": ["string"],
"jobFamily": "string",
"region": "string",
"client": "string"
}
}
Replace the dummy user with your own accounts, then Save. The blob is validated live; Save stays disabled until it is valid. Reset to defaults repopulates the editor with the shipped defaults (you still Save to apply). Changes apply immediately, no reload needed.
| Option | Meaning |
|---|---|
users |
Pre-configured accounts shown in the token dropdown. Full replacement. |
domains |
Auth server base URL per environment. Full replacement. LOCAL points at DEV by default. |
tokenEndpoint |
Path appended to the resolved domain to request a token. Full replacement. |
fullTokenTtl |
Expected full token lifetime in seconds; used to detect a freshly minted token. Merges over default. |
renewalPostExpiryBufferSecs |
Seconds after expiry to fire the renewal (must exceed client/server clock skew). Merges over default. |
showMainPageBanner |
When true, also shows the authorized banner on the main page just below the Authorize button. Hidden when the tool is disabled. Merges over default. |
usersSearchEndpoint |
Path used to search for a user by username (needed for custom claims). Full replacement. |
customClaimTokenEndpoint |
Path template used to request a token with custom claims. {referenceIdentityId} is replaced at runtime. Full replacement. |
customClaim |
Default custom claims body sent when requesting a custom-claims token. Full replacement. |
The environment (TST/DEV/LOCAL) is auto-detected from the page hostname.
Note:
users,domains, andtokenEndpointfully replace the defaults when saved, so if a future update changes a default domain you'll need to update your saved config to pick it up.
Your accounts are entered through the in-app Configuration dialog and stored privately in your browser via the userscript manager's storage (GM_setValue). They are not part of the published script, and they survive script updates.
you@example.com) only, so no real credentials live in the source.The script runs on hosts declared in its metadata header:
@grant GM_xmlhttpRequest
@grant GM_getValue
@grant GM_setValue
@grant GM_registerMenuCommand
@match https://*.publicis.com/*
@match http://localhost:*/*
@match http://127.0.0.1:*/*
@connect authorization.proconnect.tst.publicis.com
@connect authorization.proconnect.dev.publicis.com
@connect authorization.proconnect.local.publicis.com
To use it elsewhere, add the appropriate @match (page host) and @connect (auth server host) lines.
One-click token auth: pick a pre-configured user and fetch a token; both the Bearer and Basic Authentication schemes are authorized at once.
Automatic token renewal: tokens are renewed in the background so long sessions don't 401, including after the tab has been idle.
Token display: the raw Bearer <token> is shown in a read-only field for easy manual copy, and persists when you reopen the dialog.
Token with custom claims: optionally fetch a token enriched with custom claims (application, business groups, job family, region, client); the active claims are shown inline in the authorized status and the token auto-renews on the same path.
Bearer prefill: the native token input is pre-filled with Bearer (cursor at the end) so you can paste a token without typing the prefix.
Auto "Try it out": every operation opens ready to execute; the redundant toggle is hidden, Reset stays available.
Cleaner responses: static example schemas are hidden; after Execute only the live response is shown.
Show/Hide Basic Auth: a link in the auth dialog reveals the Basic Auth section when you need to interact with it manually (only shown when a Basic scheme exists, i.e. authorization service).
Enable/disable toggle: a top-bar icon turns all tweaks on or off; when off, the UI reverts to vanilla Swagger.
In-app configuration: manage your users and environment settings from a validated JSON editor; stored in your browser and preserved across script updates.
Theme-aware: injected UI inherits the page's light/dark colors.
Authorized as <user> - expires at <time>. Auto-renewal active., the token appears in the Token field, and the native Bearer/Basic sections switch to their authorized state.Select a different user and click Get token again - the previous user is logged out first, then the new user is authorized for both schemes.
customClaim from your configuration (or the default shape if not set).The flow runs in three steps:
referenceIdentityId.referenceIdentityId and your custom claims body for a claims-enriched token, then overwrites the Swagger Bearer auth with it.Steps 2 and 3 authenticate with the regular bearer token via the X-Middleware-Authorization header. If either step fails the session stays valid with the regular bearer token, and a message in the status line explains what happened.
While a custom-claims token is active, the authorized line (and the main-page banner, if enabled) shows the claims inline, for example Authorized as you@example.com with custom claims {"application":"mars"} - expires at ... Auto-renewal active.
Auto-renewal follows the same path, re-using the cached referenceIdentityId (so it skips the user search) and re-fetching a fresh custom-claims token; renewal log lines for this path are prefixed with [Custom claims].
On first use the customClaim, usersSearchEndpoint, and customClaimTokenEndpoint values are saved to your stored configuration automatically.
The Token field holds Bearer <token>. Click it to select all, then copy. It persists if you close and reopen the dialog while authorized.
The native Bearer Value input is pre-filled with Bearer and the cursor placed at the end, so you can paste just the raw token.
Click Show Basic Auth in the dialog header to reveal the Basic Authentication section (hidden by default while the tool is enabled). Click Hide Basic Auth to collapse it again. The link only appears when the spec actually defines a Basic scheme.
Use the native Logout button in the auth dialog. The tool clears its status, the token display, and the authorized line, and logs out every scheme so the UI and the actual request auth stay consistent.
Open the Configuration dialog (top-bar icon -> Configuration, the (Configure) link by the user selector, or the userscript-manager menu -> Configure...). Edit the JSON, then Save (enabled only when valid). Use Reset to defaults to start from the shipped config. Saved settings persist across updates.
Click the tool icon in the Swagger top bar and choose Enable/Disable. When disabled, the icon shows a strike-through and the page reverts to vanilla Swagger UI behavior (no auto try-it-out, no hidden responses, no injected panel). The setting persists across reloads.
The auth server caches one token per user and returns that same token (with its remaining life) until it expires, only minting a fresh one once the old has expired. The script therefore schedules each renewal to fire just after the current token expires (expiresIn + renewalPostExpiryBufferSecs), which reliably yields a fresh full-life token.
There is a brief window - about renewalPostExpiryBufferSecs seconds, once per token lifetime - where the old token has expired and the new one hasn't arrived yet. A request landing exactly there may 401 and succeed on retry. If the tab was backgrounded across the expiry (browsers throttle background timers), returning focus to the tab triggers an immediate renewal.
@match rule and that the script is enabled in Tampermonkey. Reload the page.A console helper is available for debugging Swagger store access:
window.mdtReduxDiagnostic()
It logs which store-resolution strategy works, the detected security schemes, and the current authorized state. The script also logs timestamped [MDT] lines for token fetches and renewals.
ui.getSystem(); there is no DOM-clicking fallback.Rating: 0