Simple app (angularJs <> NodeJs) setup not working

Dear community,

I have spent over 6 hours trying to get a basic setup working, so i’m posting here as a last resort.

I have followed the quick start for an AngularJS app, works fine. I have also added an API app (nodeJS/express) to my account, tested in postman using a token I generated on my console, also works great!

However, now I want to connect the two together, I am having issues.

In my angularJs app I inject authService.getAccessToken() into jwtOptionsProvider as per the docs put this access token isn’t a JWT, so it’s rejected by my API (malformed). So, I have tried IdToken, which looks more like a JWT but my API rejects it - “JsonWebTokenError: secret or public key must be provided”

I’m obviously missing a step here, at this point I feel it would been significantly quicker just to do this in house rather than using Auth0. However, I have got this far I really want to see it through.

Thanks in advance for your help!

Hi @oliver.mahoney,

Welcome to the Auth0 Community forum.

Sorry to hear about your experience, that can be very frustrating. Let us see what we can do.

The token you are likely receiving is an opaque access token described here. This usually means you are not adding your custom API as an audience to the initial request for the token.

Take a look at this doc, specifically the part I am linking with the init that includes the audience.
https://auth0.com/docs/quickstart/spa/angularjs/03-calling-an-api#configure-your-application

If this does not solve the issue we can keep working on it.

Thanks,
Dan