Getting Started

Prerequisites and security best practices for VOTR integration

⚠️ IMPORTANT SECURITY NOTES

πŸ”’ Credential Security

NEVER store Client ID and Client Secret in your frontend code!

Security Best Practices

❌ DON’T DO THIS (Insecure):

// NEVER put credentials in frontend code
const CLIENT_ID = "184hc5luf27g" // ❌ Exposed to users
const CLIENT_SECRET = "c1kf58bh43dnlq676j" // ❌ Major security risk

βœ… DO THIS (Secure):

// Frontend calls YOUR backend API
const getVotingUrl = async (userEmail: string, eventId: string) => {
  const response = await fetch("/api/voting/generate-url", {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      Authorization: `Bearer ${userAuthToken}`, // Your app's user auth
    },
    body: JSON.stringify({
      email: userEmail,
      eventId: eventId,
      environment: "development", // Your backend uses: https://api-dev.govotr.com
    }),
  })

  return response.json()
}
Frontend (React/RN) ←→ Your Backend API ←→ GoVotr API
     ↓                       ↓                ↓
- VoteNowButton SDK     - Client ID         - OAuth Token
- User Interface        - Client Secret     - Voting URLs
- No Credentials        - Secure Storage    - User Validation
                        - Environment URLs  - Development/Production

Backend Implementation (Your Server)

Your backend should handle all GoVotr API calls:

  1. Store credentials securely (environment variables, secret manager)
  2. Authenticate your users before making GoVotr API calls
  3. Validate user permissions for voting events
  4. Return only the voting URL to frontend

πŸ“‹ For complete backend implementation examples, please refer to: Sample Repository

Prerequisites

What You Need

  • Client ID and Client Secret (provided by Votr team)
  • npm or yarn
  • React or React Native project

What Votr Provides

  • govotr-vote-sdk-1.0.0.tgz file
  • Client ID (e.g., 184hc5luf27g)
  • Client Secret (e.g., c1kf58bh43dnlq676j)

Environment URLs

  • Development: https://api-dev.govotr.com
  • Production: https://api.govotr.com

GitHub Repository

For complete implementation examples and backend code: πŸ“‹ https://github.com/Govotr/Sample-IN-APP-Voting


Next Step: Install the SDK to start your integration.