a SAML token is an identity token. You need to use a browser to get an id token via the auth code or implicit flow. Currently azure ad supports using a webview for the browser, but other oauth providers are requiring a native browser. see the msal library:
https://learn.microsoft.com/en-us/entra/identity-platform/msal-overview
you can use password (your tenant must be configure to support this), or client credential (clientid, client secret) flow to get an access token (jwt) without using a browser.