Skip to content

Telefonica/opengateway-sampleapp-simswap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Open Gateway SIM Swap API Sample Application

Sample application demonstrating how to use the Open Gateway SIM Swap API.

Requirements

  • Node.js 18 or newer (for the native fetch API).
  • Open Gateway credentials with access to the SIM Swap API.
  • Run npm install once to install the dotenv dependency (already listed in package.json)

How to get Open Gateway credentials for free

  1. Sign up for a free account at Open Gateway Partner Program
  2. Access our Sandbox environment at Open Gateway Sandbox
  3. Create an application subscribing to the SIM Swap API to obtain your client_id and client_secret.

Environment variables

Set the following variables before running the CLI:

Variable Description
OG_CLIENT_ID OAuth client ID issued for your application.
OG_CLIENT_SECRET OAuth client secret.
OG_API_GATEWAY Full URL of the Open Gateway API Gateway endpoint.
OG_SIMSWAP_SCOPE Scope for the SIM Swap API (e.g. dpv:FraudPreventionAndDetection sim-swap).
OG_COUNTRY_CODE Country code (e.g., 34 for Spain) to be included in the SIM Swap request payload for the provided phone number.

You can create a .env file in the project root with the following content:

OG_CLIENT_ID=your-client-id
OG_CLIENT_SECRET=your-client-secret
OG_API_GATEWAY=https://sandbox.opengateway.telefonica.com/apigateway
OG_SIMSWAP_SCOPE="dpv:FraudPreventionAndDetection sim-swap"
OG_COUNTRY_CODE=+34

Run the CLI

node simswap.js

The script prompts for a phone number, authenticates your application and the end-user by their phone number, and retrieves the SIM swap date.

Example run

$ node simswap.js
[[email protected]] injecting env (5) from .env -- tip: 🗂️ backup and recover secrets: https://dotenvx.com/ops
Open Gateway SIM Swap Sample App

Enter phone number: (+34) 600123456

SIM Swap Date: 19 de agosto de 2025

Test in GitHub Codespaces

You can easily try out this sample application in a GitHub Codespace without needing to fork the repository or set up your local environment. Just follow these steps:

  1. Open the repository in GitHub Codespaces by appending /codespaces to the repository URL.
  2. Create a .env file in the root of the project and add your Open Gateway credentials and configuration as described above.
  3. In the terminal panel, run the application using node simswap.js and follow the prompts to test the SIM Swap API functionality.

About

Sample application demonstrating how to use the Open Gateway SIM Swap API

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published