Error "domain option is required" and "Auth0Cordova.AUTHENTICATION_TYPES.auth0" is not undefined

import Auth0Cordova from '@auth0/cordova';
import * as auth0 from 'auth0-js';
export const mcsConfig = {
  environment: 'dev',
  logHTTP: true,
    name: 'DevBackendCable',
    baseUrl: 'http://{hostname}/epc-cabling',
      type: Auth0Cordova.AUTHENTICATION_TYPES.auth0, 
      oauth: <Auth0Cordova.IOAuthConfig>{
  events : {
    userlogin : 'userlogin'
  toastDuration: 4000,
  sessionDuration: 3600,

Hi @ymphyow,

Welcome to the Auth0 Community Forum!

Would you please provide some more context so we can have a better understanding of the error you are dealing with?

For example:

  • Did you follow a quickstart/tutorial?
  • When are you getting this error?


Hello Dan,
Good day!.

Now, I retried the below link:

I am facing the crypto issue “TypeError: crypto.randomBytes is not a function
TypeError: crypto.randomBytes is not a function”.
Then, I try to solve the issue with following link :slight_smile:

But, I am stuck on the console error such as below :
Error: ENOENT: no such file or directory, open ‘C:\Users\username\Documents\ionic\Cabling\cabling2\node_modules[PACKAGE_ERROR][FILE_ERROR]’
errno: -4058,
code: ‘ENOENT’,
syscall: ‘open’,
path: ‘C:\Users\username\Documents\ionic\Cabling\cabling2\node_modules\[PACKAGE_ERROR]\[FILE_ERROR]’ }

Could you please help me?
Thank you so much.


Okay lets see, it looks like you are missing some packages. Did you follow the npm install command before trying to start the app?

I follow the below link :

  1. I install 0auth.
npm install auth0-js @auth0/cordova --save
  1. I added safariviewcontroller plugin.
ionic cordova plugin add cordova-plugin-safariviewcontroller 
ionic cordova plugin add cordova-plugin-customurlscheme --variable URL_SCHEME=io.ionic.starter  --variable ANDROID_SCHEME=io.ionic.starter --variable ANDROID_HOST=http://{hostname}/demo-0.0.1-SNAPSHOT/oauth/authorize --variable ANDROID_PATHPREFIX=/cordova/io.ionic.starter/callback
  1. I added below on line config.xml
    <preference name="AndroidLaunchMode" value="singleTask" />

  2. I added below code on app/app.component.ts

(<any>window).handleOpenURL = (url) => {
        if (state) {
          this.stateFlag = true;
        }else {
      this.stateFlag = false;


Then, I created ts file src/services/auth.service.ts and follow the instruction as below link:

When I run the apps and login, now I encounter the issue of “Error in Success callbackId: SafariViewController76610951 : TypeError: crypto.randomBytes is not a function”…

Can you confirm which version of node you are using?

My node version and angular version are below ,
ionic version is 4.12.0.
Angular CLI: 7.2.4
node -v : Node: 8.11.2
npm -v : ‘5.6.0’.

Here is my authentication info:
Token Name : projectToken
Auth URL : http://{hostname}/demo-0.0.1-SNAPSHOT/oauth/authorize
Access Token URL : http://{hostname}/demo-0.0.1-SNAPSHOT/oauth/token
Client ID : foo
Client Secre : bar


Could you DM me your tenant name and what you are using for host name?


Currently, I am using local intranet host name. not on cloud. Thank you, Dan.

Can you DM me the name of your tenant please?

I am seeing this same issue with an ionic 4 build. The problem is Angular 5 relies on the crypto library from node (and a couple other child dependencies). The solution @ymphyow linked to above in Stack Overflow resolves the crypto error, but then you have an error with Stream missing from the browser. The correct solution is auth0 needs to update their cordova package to depend on browser based crypto functions, or include the necessary node modules as dependencies in the package.

1 Like

Now, I do not use auth0 cordova plugin. I pass client id, client secrete and password credential in header. Then, the token was given. Thank you very much.

1 Like

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