I ran in to the same problem. The examples from Okta all rely on the API Access Management module (API Access Management Platform - Secure API Access | Okta) which we haven’t bought.
I found that I could get the code to work once I modified the security issuer URL. Where in the example it states
issuer: ‘https://{yourOktaDomain}/oauth2/default’,
I used
issuer: ‘https://{yourOktaDomain}’,
and it seemed to work.
See