SDK React Native - Axios

The React Native module helps you to protect your React Native applications using Axios.
The module handles 403 API responses, generated by DataDome server-side integration, in order to display the associated Captcha pages.


Use the package manager npm to install datadome-axios in your react native project repository.

npm install @datadome/datadome-axios --save


There are 4 peer dependencies for DataDome react native module:

NOTE: If you see a message from npm during the installation of DataDome module about peer dependencies, you will have to install them yourself.

For a complete install with dependencies:

npm install --save @datadome/datadome-axios @react-native-async-storage/async-storage async-barrier react-native-webview axios


For iOS, update pods by going into iOS folder and make pod installation.

cd ios/ && pod install

Integration and usage


First, import DataDome module in your project

import { DataDome, DataDomeModal, DataDomeInterceptor } from '@datadome/datadome-axios';

Set SDK Key

Add the SDK Key to DataDome instance with the method setSdkKey

export default class MyApp extends Component {
  constructor(props) {

Captcha container

The SDK needs a container to show the captcha page when needed.
Add a DataDomeModal component in top of your views. Like a modal, it will be showed only when the SDK needs to show a captcha page and can be closed by a user if he wants to (for android user).

In the DataDomeModal component, you need to set the ref of this component to the DataDome module instance.

export default class MyApp extends Component {
  render() {
    return (
    <View style={{ flex: 1, justifyContent: "center", alignItems: "center" }}>
      <DataDomeModal onRef={ref => (DataDome.getInstance().setContainerViewRef(ref))} />
      <Text>Hello, world!</Text>

Configure Axios

Before start using Axios, make sure to configure it with the DataDomeInterceptor

import axios from 'axios';

//initialize DataDome interceptor
const interceptor = new DataDomeInterceptor();

//set request intercepter
  .use(async function(request) {
    return await interceptor.requestAdapter(request)
   function(error) {
  		return Promise.reject(error);

//set response interceptor
  .use(function (response) {
  	 //sending mobile signals
     return response;
   async function(error) {
      return await interceptor.responseAdapter(error)

Use Axios

You can now use Axios the same way you used before

  .then(res => {
  .catch((error) => console.error(error));

Force a captcha display

To force the DataDome module to display a captcha, you can send a custom User-Agent header with the value BLOCKUA. This will hint the remote protection module installed on your server to block the request and consider it coming from a bot.

  .get(``, { 'headers': { 'User-Agent': 'BLOCKUA' } })
  .then(res => {
  .catch((error) => console.error(error));

Do not forget to remove this header from your code before deploying to production.


DataDome can throw some errors if it needs to. Here is the list of possible errors:

  • DATADOME ERROR: Problem on parsing of DataDomeResponse (No url object)
  • DATADOME ERROR: Can't show captcha page (No container)
  • DATADOME ERROR: Can't show captcha page (One is already in progress)
  • DATADOME ERROR: Don't put cookie headers on iOS. (Cookie handled automatically by iOS)
  • DATADOME ERROR: Captcha page closed before being passed