upstox-oauth2
v0.0.4
Published
Easy authentication for upstox api based trading.
Downloads
27
Maintainers
Readme
Upstox OAuth2 Authentication Manager
This package offers a streamlined authentication solution for integrating with Upstox's Uplink API. It simplifies the OAuth2 process by handling token caching and reuse automatically.
Key Features:
- Seamless integration into existing codebases
- Automatic management of access tokens
- Token persistence using environment variables
- Handles token expiration and renewal
Implementation Guide
1. Installation
To add this package to your project, run the following command in your terminal:
npm install upstox-oauth2
2. Usage
Incorporate the authentication manager into your code with minimal effort:
import performAuth from "upstox-oauth2";
// Obtain the access token
const accessToken = await performAuth();
// Use the access token for API requests
3. Configuration
Proper setup requires specific environment variables. Ensure your .env
file includes the following:
CLIENT_ID="your_upstox_client_id"
CLIENT_SECRET="your_upstox_client_secret"
REDIRECT_URI="http://localhost:3000/redirect"
Important: Configure your Upstox application settings to use the exact redirect URI specified above.
4. Additional Information
For comprehensive details on setting up your Upstox integration, including obtaining your client credentials, please refer to the official Upstox API documentation.
This authentication manager simplifies the OAuth2 process, allowing developers to focus on building features rather than managing authentication flows. By automatically handling token lifecycle, including storage and renewal, it provides a robust foundation for interacting with Upstox's Uplink API.