//native
/**
* List User Factors
* List the MFA factors enrolled for a user (e.g. Okta Verify, SMS, email, WebAuthn).
*/
export async function main(auth: RT.Okta, user_id: string) {
const url = new URL(
`${auth.org_url}/api/v1/users/${encodeURIComponent(user_id)}/factors`
)
const response = await fetch(url, {
method: "GET",
headers: {
Authorization: `SSWS ${auth.token}`,
Accept: "application/json",
},
})
if (!response.ok) {
throw new Error(`${response.status} ${await response.text()}`)
}
return await response.json()
}
Submitted by hugo989 5 days ago