Friday 9 June 2017

Node.js how do you read a JSON with an element that is a HTTP address

OK I just ran into an issue. I am using Auth0 to create users with different rights (not scopes just rights) in the App Metadata. When I decode the Token I get this json:

{
  "iss": "https://testing.auth0.com/",
  "sub": "auth0|58e7bae154941844b507eaf5",
  "aud": "OSBkLd832tIhpDe0QFJbQ9vutgB2s6cJ",
  "exp": 1497016797,
  "iat": 1496980797,
  "https://thetestgroup.com/app_metadata": {
    "is_admin": true
  }
}

As you can see the app metadata is in the element "https://thetestgroup.com/app_metadata". Normally I would just do something like this in my code (auth.payload.iat) to get the iat but for the app_metadata it rejects it because of the :. Is there a good way to get at that data?



via Justin Yanta

No comments:

Post a Comment