This thread is trying to answer question "How to get a token using Okta API in C#?"
Hi, I use auth setup for API login to OKTA but with JS. Nevertheless the main idea and structure of the request should be the same i believe
// Send authentication request.
setup('authenticate', async ({ request }) => {
const response = await request.post(authUrl, {
data: {
options: {
multiOptionalFactorEnroll: true,
warnBeforePasswordExpired: true
},
password: pass,
username: user
}
})
const token = await response.json()
// auth with request playwright using cookies
const auth = await request.get(
`https://<yourdomain>.okta.com/login/sessionCookieRedirect?token=${token.sessionToken}&redirectUrl=${redirectUrl}`
)
console.log(
`***** Logged in as user: ${user} with status ${auth.status()}, ${auth.statusText()}, saving storage state *****`
)
await request.storageState({ path: authFile })
})
Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email [email protected].