Auth0 Home Blog Docs

Set custom authentication parameters in Ionic



I need to set additional parameters in Auth0.js (Ionic/Cordova application).
When using Lock, you can simply do this:

var lock = new Auth0Lock('clientID', '', {
auth: {
 params: {
  audience: 'apiurl'

I think it needs to be done in auth0config in the service but i’m not sure how. Who can explain me or point me to the right documentation?

 const auth0Config = {
 // needed for auth0
  clientID: 'id',

 // needed for auth0cordova
 clientId: 'id',
 domain: 'url',
 callbackURL: location.href,
 packageIdentifier: 'id',



In Ionic/Cordova the Auth0.js library is not used to drive the main authentication flow and instead it’s more a helper library. For example, the Ionic 2 quickstart only uses the Auth0.js library to perform a call to the /userinfo endpoint; the actual authentication flow is performed through auth0-cordova.

With the above in mind, if your requirement is to pass additional parameters specific to the authentication flow then you’ll need to include those in association with auth0-cordova. In particular, you can provide a specific audience by including it as an additional property on the options object passed to the authorize method of Auth0 Cordova.

In the linked quickstart above you have the following options:

const options = {
  scope: 'openid profile offline_access'

which you can augment to:

const options = {
  scope: 'openid profile offline_access',
  audience: '[your_audience_here]'


Thanks for the answer.
Adding this doesn’t change anything in my jwt, however adding the audience argument AND removing the scope argument does change the audience to the my audience. But this isnt a solution as the accestoken gets the value of the id token and the id token will become undefined.
Do you know what options I have left?


The answer as given by @jmangelo in combination with my post on stackoverflow resolved the issue.


That is intriguing, I just saw the SO question and answer and I have to confess that I originally only looked at the code and since it documented the audience parameter I assumed it would just work… thanks for the follow-up and link to SO.