<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-M74D8PB" height="0" width="0" style="display:none;visibility:hidden">
Loading
Skip to NavigationSkip to Main Content
0D51Y00008cfYaBSAUOkta Classic EngineSingle Sign-OnAnswered2020-07-19T08:31:55.000Z2020-05-29T00:32:11.000Z2020-07-19T08:31:55.000Z

fis.28013 (Customer) asked a question.

Error: expected audience is required

Hi Okta, I have follow the guideline from Okta for build pwa basic CRUD from https://developer.okta.com/blog/2018/02/15/build-crud-app-vuejs-node*complete-the-posts-manager-component .

 

The app running successfully including login on okta. But, when i want save post, there is no data update on that table. The error i get from the console are:

 

Error: expected audience is required

at verifyAudience, OktaJWTVerifier & processTicksAndRejections

 

How to solve this problem?

 

Thanks .


  • Hi fi sya,

     

    The Okta JWT verifier has been updated since the blog article was written and it requires a secondary parameter for "verifyAccessToken" method which contains the audience that is expected in the token.

     

    Can you please change all the references for verifyAccessToken and add a secondary parameter function, for example verifyAccessToken(accessToken, "api://default"), and try again?

     

    The audience is available in the Settings of your authorization server under Admin >> API >> Authorization Servers >> Audience.

     

    Dragos Gaftoneanu

    Developer Support Engineer

    Okta Global Customer Care

     

    Expand Post
  • EmmanuelA.46087 (Customer)

    Add an extra argument to the verify access token method.

      oktaJwtVerifier.verifyAccessToken(accessToken, 'api://default')

        .then(jwt => {

          req.user = {

            uid: jwt.claims.uid,

            email: jwt.claims.sub

          }

          next();

        })

        .catch(next); // jwt did not verify!.

    Expand Post
This question is closed.
Loading
Error: expected audience is required
Okta Support Agent (Beta)

Terms of Service

Hello! I'm the Okta Support Agent (Beta), your go-to resource for questions about Okta products. Please remember for your security and privacy, do not share any Personally Identifiable Information (PII) such as passwords, IP addresses, or other details with me.

Okta Privacy Policy and Terms of Service apply