# Lock widget redirect goes wrong when using audience

**URL:** <https://community.auth0.com/t/lock-widget-redirect-goes-wrong-when-using-audience/7262>\
**Category:** Get Help\
**Tags:** auth0-lock, react-native, audience, redirect\
**Created:** [June 26, 2017, 1:45pm UTC](https://community.auth0.com/t/lock-widget-redirect-goes-wrong-when-using-audience/7262 "2017-06-26T13:45:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![and.nil](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@and.nil](https://community.auth0.com/u/and.nil)\
**Post date:** [June 26, 2017, 1:45pm UTC](https://community.auth0.com/t/lock-widget-redirect-goes-wrong-when-using-audience/7262/1 "2017-06-26T13:45:33Z")

</div>

Hi,  
I have a react native app, with a lock widget config that looks like this

```
var lock = new Auth0Lock({
    clientId: config.clientid, domain: config.domain,
});

lock.show({
    authParams: {
        scope: "openid email",
        audience: config.audience,
    }
}, (err: any, profile: any, token: any) => {
    //do stuff
});

```

Using this setup, the authentication works just fine. I can see in the logs on my auht0 dashboad that it works, however in the Lock UI i get an error message “There was an error processing the sign in”.

If i remove the authParams in lock.show, the error message is gone. The problem with this is that I only recieve the opaque access token, not a real jwt token wich is what I´m looking for.

If I (as in [this](https://github.com/auth0/react-native-lock/blob/master/sample-app/app.js) example) use the useBrowser: true option, I can see that the login provider redirects the request back to auth0 successfully. The callback looks something like this:

a0[clientid]://[my auth0 domain].eu.auht0.com/callback#[a uri encoded access token]  
[my auth0 domain]/authorize?scope=openid email&auth0client=[looks lika a jwt token]&clientid=[clientid]&response\_type=token&audience=[my audience]&redirecturi=[the callback uri coming here next]&connection=[the auth provider]

And after that, the request is redirected back again the the provided callback uri:  
a0[clientid]://[my auth0 domain].eu.auht0.com/callback#[a uri encoded jwt token]

That uri returns a 404 error and the lock widget failes to parse the response I´m guessing.

The jwt token in the last callback is a valid one. I can manually parse it and use it to access my web api.

Anyone has any idé how i can continue troubleshooting?

---

<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:** [July 6, 2017, 4:06pm UTC](https://community.auth0.com/t/lock-widget-redirect-goes-wrong-when-using-audience/7262/2 "2017-07-06T16:06:27Z")

</div>

The `react-native-lock`library makes use of some legacy endpoints and according to the GitHub repository [README](https://github.com/auth0/react-native-lock#before-you-start) is only currently receiving bug fixes.

Given you’re making use of API Authorization feature (aka audience parameter) which is something that is not available in the legacy endpoints, the recommendation is to make use of the `react-native-auth0` [library](https://github.com/auth0/react-native-auth0) instead.

---

<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:54am UTC](https://community.auth0.com/t/lock-widget-redirect-goes-wrong-when-using-audience/7262/3 "2018-03-02T05:54:57Z")

</div>


