Okta: Fetching Access Token via JavaScript

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

154 thoughts on “Okta: Fetching Access Token via JavaScript”

  1. Pingback: purchase viagra
  2. Pingback: cheap viagra
  3. Pingback: generic viagra
  4. Pingback: sildenafil 50 mg
  5. Pingback: viagra price
  6. Pingback: cialis discount
  7. Pingback: can you buy cialis
  8. Pingback: buy cialis cheap
  9. Pingback: herbal viagra
  10. Pingback: generic for viagra
  11. Pingback: cialis on line
  12. Pingback: canadian cialis
  13. Pingback: buy viagra online
  14. Pingback: cialis rx
  15. Pingback: peptides tadalafil
  16. Pingback: tadalafil generic
  17. Pingback: sildenafil 50mg
  18. Pingback: cheapest viagra
  19. Pingback: viagra canada
  20. Pingback: hims viagra
  21. Pingback: herb viagra
  22. Pingback: viagra pour homme
  23. Pingback: what is viagra
  24. Pingback: viagra pornhub
  25. Pingback: viagra on line
  26. Pingback: viagra connect
  27. Pingback: online viagra
  28. Pingback: viagra tablet
  29. Pingback: goodrx sildenafil
  30. Pingback: walgreens viagra

Leave a Comment