I've been struggling to really understand the Okta docs regarding this but basically im trying to fetch an Okta Access Token via their API using Vanilla JS.
I am using the following JS SDK to simplify things: https://github.com/okta/okta-auth-js
this is my code:
let oktaConfig = {
issuer: 'https://{OKTA_DOMAIN}/oauth2/default/v1/token',
clientId: "CLIENT_ID",
tokenManager: {
storage: 'sessionStorage'
}
}
const oktaAuth = new OktaAuth(oktaConfig)
oktaAuth.signInWithCredentials({
username: "USER",
password: "PASSWORD"
}).then(function(data) {
console.log(data)
let token = data.data.stateToken
console.log(token)
From the request I retrieve a "stateToken" however how am I able to then retrieve a Access Token?
TIA