# Set custom authentication parameters in Ionic

**URL:** <https://community.auth0.com/t/set-custom-authentication-parameters-in-ionic/8418>\
**Category:** Get Help\
**Tags:** access-token, postman\
**Created:** [October 8, 2017, 10:45pm UTC](https://community.auth0.com/t/set-custom-authentication-parameters-in-ionic/8418 "2017-10-08T22:45:08Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![me7](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@me7](https://community.auth0.com/u/me7)\
**Post date:** [October 8, 2017, 10:45pm UTC](https://community.auth0.com/t/set-custom-authentication-parameters-in-ionic/8418/1 "2017-10-08T22:45:08Z")

</div>

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', 'account.auth0.com', {
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',

};

```

---

<div class="post-metadata">

**Author:** ![jmangelo](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jmangelo/32/7923_2.png) [@jmangelo](https://community.auth0.com/u/jmangelo)\
**Post date:** [October 9, 2017, 3:11pm UTC](https://community.auth0.com/t/set-custom-authentication-parameters-in-ionic/8418/2 "2017-10-09T15:11:09Z")

</div>

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](https://auth0.com/docs/quickstart/native/ionic2/01-login) 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]'
};

```

---

<div class="post-metadata">

**Author:** ![me7](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@me7](https://community.auth0.com/u/me7)\
**Post date:** [October 9, 2017, 4:34pm UTC](https://community.auth0.com/t/set-custom-authentication-parameters-in-ionic/8418/3 "2017-10-09T16:34:40Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![me7](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@me7](https://community.auth0.com/u/me7)\
**Post date:** [October 10, 2017, 4:43pm UTC](https://community.auth0.com/t/set-custom-authentication-parameters-in-ionic/8418/4 "2017-10-10T16:43:16Z")

</div>

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

> <https://stackoverflow.com/questions/46635058/authparams-in-auth0js/46647399#46647399>

---

<div class="post-metadata">

**Author:** ![jmangelo](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jmangelo/32/7923_2.png) [@jmangelo](https://community.auth0.com/u/jmangelo)\
**Post date:** [October 10, 2017, 8:30pm UTC](https://community.auth0.com/t/set-custom-authentication-parameters-in-ionic/8418/5 "2017-10-10T20:30:42Z")

</div>

That is intriguing, I just saw the SO question and answer and I have to confess that I originally only looked at the [code](https://github.com/auth0/auth0-cordova/blob/master/src/index.js#L58) and since it documented the audience parameter I assumed it would just work… thanks for the follow-up and link to SO.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [March 2, 2018, 5:56am UTC](https://community.auth0.com/t/set-custom-authentication-parameters-in-ionic/8418/6 "2018-03-02T05:56:52Z")

</div>


