In my Okta tenant, I have created a SPA and that authentication part is working fine. My API is a separate one and it's spring boot microservice. I already integrated it with spring boot Okta starter. It's also working fine (Both Authentication and Authorization). But for my service's tests (integration tests), I need to generate access token to use as Authentication token, programmatically which I still stuck on. I was able to generate session token using following API,
https://dev-xxxx.okta.com/api/v1/authn
{ "username": "client@xx.com", "password": "xxxxxx", "options": { "multiOptionalFactorEnroll": false, "warnBeforePasswordExpired": false } }
Can someone help on this?
I would recommend that you use a different OAuth app configured in Okta to use the Resource Owner Password flow. You pass it a username and password, just like the authentication API you posted above.
You also need a client id and a client secret, which is why you'd need an additional app defined in Okta - a SPA app doesn't get a client secret.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.