Skip to main content

SDK Signing

SDK signing enhances the security of the Apptrove React Native SDK by authenticating requests sent to the Trackier Mobile Marketing Platform (MMP) using a secret ID and secret key. This ensures data integrity and prevents unauthorized access to your tracking data. This section outlines how to configure SDK signing in your React Native application.

Prerequisites

  • Apptrove React Native SDK installed and initialized in your project
  • A Trackier MMP account with access to the Trackier Panel
  • React Native 0.60 or later
  • Basic knowledge of JavaScript and React Native development

Configure SDK Signing

To enable SDK signing, retrieve the secret ID and secret key from the Trackier Panel and add them to the SDK configuration during initialization.

Step 1: Retrieve Secret ID and Secret Key

  1. Log in to your Trackier Panel.
  2. Select your application from the Dashboard.
  3. Navigate to SDK Integration via the left-side navigation menu.
  4. Click on the Advanced tab under SDK Integration.
  5. Copy the Secret ID and Secret Key displayed.

Step 2: Add Signing to SDK Initialization

Modify your SDK initialization code to include the secret ID and secret key using the setAppSecret method of the TrackierConfig object.

JavaScript Example
App.js
import React from 'react';
import { TrackierConfig, TrackierSDK } from 'react-native-trackier';
import { StyleSheet, Text, View } from 'react-native';

export default function App() {
// Initialize SDK with Signing
const trackierConfig = new TrackierConfig("67607dc5-xxxx-xxxx-xxxx-b577324d97ce", TrackierConfig.EnvironmentDevelopment);
trackierConfig.setAppSecret("640710587xxxx6ac0cb370", "9e043b7e-7f44-403c-xxxx-8cf6bfe8daa0"); // Pass secretId and secretKey
TrackierSDK.initialize(trackierConfig);

return (
<View style={styles.container}>
<Text>Apptrove React Native SDK with Signing</Text>
</View>
);
}

const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
},
});

Parameters

  • Secret ID: The unique identifier for request authentication (e.g., "640710587xxxx6ac0cb370").
  • Secret Key: The secure key paired with the secret ID (e.g., "9e043b7e-7f44-403c-xxxx-8cf6bfe8daa0").

Expected Outcome

The SDK will sign all requests with the provided secret ID and key, ensuring secure communication with the Trackier MMP. You can verify successful authentication by checking tracking data (e.g., events, user data) in the Trackier Panel without errors.

Best Practices

  • Secure Secret Credentials: Store the secret ID and key securely in environment variables or a configuration file, avoiding hardcoding in source code.
  • Validate Credentials: Ensure the secret ID and key are correctly copied from the Trackier Panel to prevent authentication failures.
  • Test in Development Mode: Use TrackierConfig.EnvironmentDevelopment to test SDK signing without affecting production data.
  • Initialize Early: Call setAppSecret during SDK initialization to ensure all subsequent requests are signed.
  • Monitor Authentication: Check the Trackier Panel for any authentication-related issues during testing.
  • Comply with Privacy Regulations: Ensure secure handling of tracking data complies with GDPR, CCPA, and other privacy laws.

Troubleshooting

  • Authentication Errors:
    • Verify the secret ID and key match the values in the Trackier Panel's Advanced tab.
    • Ensure setAppSecret is called before TrackierSDK.initialize.
    • Check console logs for authentication-related errors.
  • Tracking Data Not Appearing:
    • Confirm the SDK is initialized with the correct app token and environment.
    • Ensure the secret ID and key are associated with the correct application in the Trackier Panel.
  • General Issues:
    • Check console logs for errors related to TrackierSDK.initialize.

For further assistance, refer to the Trackier Documentation Portal or contact Trackier support at support@trackier.com.