Last active
August 14, 2024 22:20
-
-
Save epidemicz/7efcac967357e31cc25d6a06782f375d to your computer and use it in GitHub Desktop.
Copy Swagger Access Token Bookmarklet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Find the first access token from a swagger response called 'accessToken' & copy it to the clipboard. | |
// Usage: drag the block of code below this line to your bookmarks bar or just make a new one and paste it as the url | |
javascript:(function(){ | |
for (const e of document.querySelectorAll('.language-json')) { | |
const { accessToken } = JSON.parse(e.innerText); | |
if (accessToken && accessToken.length > 100) { | |
console.log(accessToken); | |
const text = `Bearer ${accessToken}`; | |
navigator.clipboard.writeText(text); | |
return; | |
} | |
} | |
})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment