I create the app on the Expo React Native and it's necesary that in any time use the auth with mercadopago api to get the response_typo code thast come on redirect url.For this, I use webview, but I cant get the URL that mercadopago returns whit this url. How I can get the redirect and if is that I needed, close the webview to procedure the others functions?
<WebView
ref={(element) => { this.webViewRef = element; }}
source={{
uri: this.state.currentUrl
}}
onNavigationStateChange={this.onNavigationStateChange.bind(this)}
onError={(err)=>console.warn(err)}
onShouldStartLoadWithRequest = {this.onNavigationStateChange.bind(this)}
javaScriptEnabled={true}
domStorageEnabled={true}
startInLoadingState={true}
onMessage={this.onMessage}
style={{ flex: 0, margin: 10,}}
/>
More especific, onNavigationStateChange return the first and second redirect but not work at last redirect where come the code thast I need.
The inicial URL is:
this.setState({ currentUrl: `https://auth.mercadopago.com.ar/authorization?`+
`client_id={<ID_of_client>}`+
`&response_type=code`+
`&platform_id=mp`+
`&redirect_uri={<URI_TO_RETURN_THE_CODE_THATS_I_NEED>}`
})