PayMitto Token Response
Overview
The PayMittoTokenResponse 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 PayMittoTokenResponse {
accessToken: string;
expiresIn: number;
scope: string;
tokenType: string;
}Properties
| Property | Type | Required | Description |
|---|---|---|---|
| accessToken | string | Yes | The OAuth 2.0 access token issued by the PayMitto API |
| expiresIn | number | Yes | The lifetime of the access token in seconds |
| scope | string | Yes | The scope of the access token (e.g., paymitto:write) |
| tokenType | string | Yes | The type of token issued (typically Bearer) |
Sample Usage
import type { PayMittoTokenResponse } from 'react-native-paymitto-sdk';
const fetchAccessTokenDetails = async (): Promise<PayMittoTokenResponse> => {
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": "paymitto:write",
"tokenType": "Bearer"
}Related
- Fetch Access Token Details - Callback that returns this response
- PayMittoError - Error response structure when authentication fails
