authResult return idToken as Null

The code which i have here gives me the authresult object in my console but i get the value as Null for idToken

<---- App.js ---->
import React from ‘react’;
import logo from ‘./logo.svg’;
import ‘bootstrap/dist/css/bootstrap.min.css’;
import ‘./App.css’;
import Apicall from ‘./Apicall’;
import Header from ‘./components/Header’;
import Auth0Lock from ‘auth0-lock’;

class App extends React.Component{

constructor(){
super();
this.state ={
idToken:‘’,
profile:{}
};
}

static defaultProps = {
clientID:“0wESJsu7YgBK8EUUADH9qOBXTP5P5duz” ,
domain :“dev-thsfactory47.auth0.com
}
componentWillMount(){
this.lock = new Auth0Lock(‘0wESJsu7YgBK8EUUADH9qOBXTP5P5duz’,‘dev-thsfactory47.auth0.com’);

this.lock.on(“authenticated”, (authResult)=>{
console.log(authResult);
});
}

showLock(){
this.lock.show();
}

render(){
return (



logo






);
}
}
export default App;


Allowed Callback URLs | Allowed Web Origins | Allowed Logout URLs
Allowed Origins (CORS) are all set as http://localhost:3000/

----------------------------------------Value in Console----------------------------------------------------------------------------------

  1. {accessToken: “BPWOxQMHDXvdq-1rB8FJPnngt5mM93BR”, idToken: null, idTokenPayload: null, appState: null, refreshToken: null, …}

  2. accessToken: “BPWOxQMHDXvdq-1rB8FJPnngt5mM93BR”

  3. appState: null

  4. expiresIn: 7200

  5. idToken: null

  6. idTokenPayload: null

  7. refreshToken: null

  8. scope: null

  9. state: “VvrtO43HpACk3mSgRSxOkv~P2cXKxabr”

  10. tokenType: “Bearer”

Kindly help

It seems that you’re missing the proper scope for an OpenID Connect request. Add scopes like openid profile email and also the response_type should be token id_token.

See the example at Lock v11 for Web (but replace Auth0LockPasswordless with Auth0Lock).

var lockPasswordless = new Auth0Lock(
 '0wESJsu7YgBK8EUUADH9qOBXTP5P5duz',
 'dev-thsfactory47.auth0.com',
 {
  auth: {
    redirectUrl: 'http://localhost:3000/',
    responseType: 'token id_token',
    params: {
      scope: 'openid profile email' 
    } 
 }
);

By the way: you’re using the embedded login via Lock SDK, not the Auth0 hosted Universal Login Page (ULP). Is it a requirement? Asking because using the ULP is usually easier and comes with less problems (as outlined in the yellow box on https://auth0.com/docs/libraries/lock/v11).