Auth0 Home Blog Docs

Native and M2M connected to the same database behave differently

Hey I am running a M2M application against a backend server. On the M2M application everything works like authorization. Getting data from the API. Now a tried to add a Native application to it. React native with webauth module. Using the client_id I managed to get a accessToken and a idToken. Using this accessToken I make a request to the API and get:

{
  "timestamp": "2019-04-11T10:57:42.921+0000",
  "status": 401,
  "error": "Unauthorized",
  "message": "Unauthorized",
  "path": "/groups"
} 

While using the M2M token I get the result and everything works.

Native call on backends log:
Apr 11 12:39:06 x heroku/router: at=info method=GET path="/groups" host=hero.app request_id=f04a-4304-a47b-035fd0c8f7fd fwd="83.23.100.226" dyno=web.1 connect=0ms service=8ms status=401 bytes=527 protocol=https 
M2M call on backends log:
Apr 11 12:40:28 x app/web.1: 2019-04-11 10:40:27.748  INFO 4 --- [io-44767-exec-2] c.a.s.s.api.JwtAuthenticationProvider    : Authenticated with jwt with scopes [openid, profile, email] 
Apr 11 12:40:28 x heroku/router: at=info method=GET path="/groups" host=hero.app request_id=89cf-41d0-b5e2-f2d5458ea095 fwd="83.23.100.226" dyno=web.1 connect=0ms service=331ms status=200 bytes=546 protocol=https 

The two applications are connected to the same database. The config is identical on auth0-s site. I dont know what is happening. Any clues?

Found the error. it was mismatching audience.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.