ReadyRemit Token Response

Authentication token response structure

Overview

The ReadyRemitTokenResponse interface defines the structure of a successful authentication token response. This response should be returned by your fetchAccessTokenDetails callback when the SDK requests authentication.


Definition

export interface ReadyRemitTokenResponse {
  accessToken: string;
  expiresIn: number;
  scope: string;
  tokenType: string;
}

Properties

PropertyTypeRequiredDescription
accessTokenstringYesThe OAuth 2.0 access token issued by the ReadyRemit API
expiresInnumberYesThe lifetime of the access token in seconds
scopestringYesThe scope of the access token (e.g., readyremit:write)
tokenTypestringYesThe type of token issued (typically Bearer)

Sample Usage

import type { ReadyRemitTokenResponse } from 'react-native-ready-remit-sdk';

const fetchAccessTokenDetails = async (): Promise<ReadyRemitTokenResponse> => {
  const response = await fetch('https://your-api.com/oauth/token', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({ /* your auth params */ }),
  });

  const data = await response.json();

  return {
    accessToken: data.access_token,
    expiresIn: data.expires_in,
    scope: data.scope,
    tokenType: data.token_type,
  };
};

Example Response

{
  "accessToken": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...",
  "expiresIn": 3600,
  "scope": "readyremit:write",
  "tokenType": "Bearer"
}

Related