Template Repository
A comprehensive walkthrough of the Okto TS Template App designed for Okto APIs. This template demonstrates core Okto functionality—including authentication, wallet management, and blockchain interactions—so you can quickly get started building with Okto.
Customize Before Production
Please note that this template is for development and testing purposes only. Be sure to customize and secure it before using in production.
API Reference Template Repository
Script Links
Below are the links to individual scripts available in the GitHub repository:
Authenticate Scripts
Script | GitHub Link |
---|---|
Google OAuth | View on GitHub |
Email Authenticate | View on GitHub |
WhatsApp Authenticate | View on GitHub |
JWT Authenticate | View on GitHub |
Delegated Actions | View on GitHub |
Treasury Wallet | View on GitHub |
Intent Scripts
Script | GitHub Link |
---|---|
Token Transfer Intent | View on GitHub |
NFT Transfer Intent | View on GitHub |
Raw Transaction Intent | View on GitHub |
Swap Intent | View on GitHub |
Sign Data | View on GitHub |
Getting Started
Find detailed instructions on how to set up the template app locally:
- Clone the repository:
git clone https://github.com/okto-hq/okto-sdkv2-ts-template.git
- Change into the project directory and install dependencies:
cd okto-sdkv2-ts-template
npm install
- Set up environment variables:
cp .env.sample .env
- Add your API keys to the
.env
file:
# The Okto environment "sandbox" or "production"
OKTO_ENVIRONMENT =
# Get the below values from Okto Developer Dashboard. Learn how here- https://docs.okto.tech/docs/developer-admin-dashboard
OKTO_CLIENT_PRIVATE_KEY =
OKTO_CLIENT_SWA =
#optional: only needed if using google authenticate
# For testing purposes, you can generate the id token from here
# - https://docs.okto.tech/docs/openapi/authenticate/google-oauth/get-token-id
# NOTE: The google ID token has a very short expiry. Please generate a new token just before running this code. You can check the expiry at jwt.io
GOOGLE_ID_TOKEN =
# when testing intents or using delegated access you will have to generate the okto auth token from session config
# For testing purposes, you can generate the okto auth token from our tool 'Session and Okto Auth Token Generator'
# - https://docs.okto.tech/tools
OKTO_AUTH_TOKEN =
Before you begin, set up your developer dashboard by making sure you have :
- Created your Okto Developer Dashboard account
- Get your Okto credits from the dashboard
- Obtained your API keys from the dashboard
- Enabled the specific Chains and Tokens you plan to use in your application
- Optional: Enabled Sponsorship for the desired chains
If you need help, reach out to us on our troubleshooting form and we will contact you.
- Okto API Keys: You need your
CLIENT_PRIVATE_KEY
andCLIENT_SWA
. Obtain these from the Okto Developer Dashboard. - Okto Account Setup: Ensure you have sufficient Okto Credits, enable the required Chains and Tokens , and optionally Activate Sponsorship.
- Google OAuth Credentials (if using Google authentication): Create OAuth 2.0 credentials in the Google Cloud Console to get your
GOOGLE_CLIENT_ID
.
- Execute the script you want to run:
tsx path/to/your/script.ts