Basic validation of web login

I want to use the web login as an auth in my own API. Is there a way I can use validation tokens, etc. data from the client in my headers that my server side app can then use to validate the authoritiy of my API queries from the server side?

I am trying to connect with
const domain = ‘https://wonderworld.auth0.com/api/v2/’;

const AuthenticationClient = require(‘auth0’).AuthenticationClient;

const auth0 = new AuthenticationClient({
domain,
clientId: ‘-- my client token’
});

auth0.getProfile(‘-- an access token’)
.then((result) => {
console.log('result: ', result);
})
.catch((err) => {
console.log('error: ', err);
});
and getting

error:  { Error: getaddrinfo ENOTFOUND https https:443
    at errnoException (dns.js:50:10)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:92:26)
  code: 'ENOTFOUND',
  errno: 'ENOTFOUND',
  syscall: 'getaddrinfo',
  hostname: 'https',
  host: 'https',
  port: 443 }

Hi dave3

The error is because your domain should be ‘wonderworld.auth0.com’.

On .a larger scope, I would suggest being careful about choosing which flow (authorization code, implicit, PKCE, client credentials etc.) you implement here. Each flow is designed for certain architectures, and you should make sure that you choose the flow that matches your architecture.

John

1 Like