Upstox Auth Pro is a high-performance Java library designed to automate the Upstox API login flow. It handles Headless Login, 2FA (TOTP) generation, and Authorization Code capture entirely through code.
- 🕵️ Stealth Automation: Uses Playwright for Java with built-in headers to bypass bot detection.
- 🔐 Integrated TOTP: Automatically generates 2FA codes using Aerogear OTP.
- 📦 Persistent Storage: Built-in
FileStorageusing Jackson for JSON serialization. - 🛠️ Fluent API: Clean Builder pattern for easy configuration.
Add this to your pom.xml:
<dependency>
<groupId>com.upstox.auth</groupId>
<artifactId>upstox-auth-pro</artifactId>
<version>0.1.0</version>
</dependency>import com.upstox.auth.UpstoxAuthenticator;
import com.upstox.auth.storage.FileStorage;
public class Main {
public static void main(String[] args) {
UpstoxAuthenticator auth = new UpstoxAuthenticator.Builder()
.apiKey("YOUR_API_KEY")
.apiSecret("YOUR_API_SECRET")
.redirectUri("https://your-redirect-url.com")
.mobileNo("9876543210")
.pin("123456")
.totpKey("YOUR_TOTP_KEY")
.storage(new FileStorage("upstox_token.json"))
.headless(true)
.build();
// This will check storage first, and only automate login if needed
String accessToken = auth.getAccessToken();
System.out.println("Valid Access Token: " + accessToken);
}
}Please refer to the Upstox Developer Portal to get your API Key and Secret. For the TOTP Key, check your Upstox Security settings under 2FA.
Distributed under the MIT License.