Installation Guide
Complete installation instructions for integrating Plinto into your project.
Prerequisites
Before installing Plinto, ensure you have:
- Node.js 16.8+ for JavaScript/TypeScript projects
- Python 3.8+ for Python projects
- Go 1.19+ for Go projects
- A Plinto account (sign up here)
JavaScript/TypeScript Installation
Next.js (Recommended)
For Next.js applications with App Router:
npm install @plinto/nextjs
React
For standalone React applications:
npm install @plinto/react-sdk
Vue
For Vue 3 applications:
npm install @plinto/vue
Universal JavaScript
For other JavaScript frameworks or Node.js:
npm install @plinto/js
Python Installation
Using pip
pip install plinto-python
Using poetry
poetry add plinto-python
Framework-specific packages
For Django:
pip install plinto-django
For FastAPI:
pip install plinto-fastapi
For Flask:
pip install plinto-flask
Go Installation
go get github.com/plinto/plinto-go
Environment Setup
1. Create Your Application
- Go to app.plinto.dev
- Sign up or log in to your account
- Click "Create New Application"
- Configure your application settings:
- Name: Your application name
- Domain: Your application domain (e.g.,
localhost:3000
for development) - Redirect URIs: Where users return after authentication
- Logout URIs: Where users go after logout
2. Get Your Credentials
After creating your application, you'll receive:
PLINTO_ISSUER=https://api.plinto.dev
PLINTO_AUDIENCE=your-unique-audience-id
PLINTO_CLIENT_ID=your-client-id
PLINTO_CLIENT_SECRET=your-client-secret
3. Environment Variables
Create appropriate environment files for your framework:
Next.js (.env.local
)
PLINTO_ISSUER=https://api.plinto.dev
PLINTO_AUDIENCE=your-audience
PLINTO_CLIENT_ID=your-client-id
PLINTO_CLIENT_SECRET=your-client-secret
PLINTO_REDIRECT_URI=http://localhost:3000/api/auth/callback
Python (.env
)
PLINTO_ISSUER=https://api.plinto.dev
PLINTO_AUDIENCE=your-audience
PLINTO_CLIENT_ID=your-client-id
PLINTO_CLIENT_SECRET=your-client-secret
PLINTO_REDIRECT_URI=http://localhost:8000/auth/callback
Go (environment or config file)
export PLINTO_ISSUER=https://api.plinto.dev
export PLINTO_AUDIENCE=your-audience
export PLINTO_CLIENT_ID=your-client-id
export PLINTO_CLIENT_SECRET=your-client-secret
Framework-Specific Configuration
Next.js Configuration
Create lib/plinto.ts
:
import \{ Plinto \} from '@plinto/nextjs'
export const plinto = new Plinto(\{
issuer: process.env.PLINTO_ISSUER!,
audience: process.env.PLINTO_AUDIENCE!,
clientId: process.env.PLINTO_CLIENT_ID!,
clientSecret: process.env.PLINTO_CLIENT_SECRET!,
redirectUri: process.env.PLINTO_REDIRECT_URI!,
// Optional configuration
sessionCookieName: 'plinto-session',
sessionDuration: 24 * 60 * 60 * 1000, // 24 hours
refreshTokenRotation: true,
\})
React Configuration
Create lib/plinto.ts
:
import \{ PlintoProvider \} from '@plinto/react-sdk'
const plintoConfig = \{
issuer: process.env.REACT_APP_PLINTO_ISSUER!,
audience: process.env.REACT_APP_PLINTO_AUDIENCE!,
clientId: process.env.REACT_APP_PLINTO_CLIENT_ID!,
redirectUri: window.location.origin + '/callback',
\}
// Wrap your app with PlintoProvider
function App() \{
return (
<PlintoProvider config=\{plintoConfig\}>
<YourAppComponents />
</PlintoProvider>
)
\}
Python Configuration
Create config/plinto.py
:
import os
from plinto import Plinto
plinto = Plinto(
issuer=os.getenv('PLINTO_ISSUER'),
audience=os.getenv('PLINTO_AUDIENCE'),
client_id=os.getenv('PLINTO_CLIENT_ID'),
client_secret=os.getenv('PLINTO_CLIENT_SECRET'),
redirect_uri=os.getenv('PLINTO_REDIRECT_URI'),
# Optional configuration
session_duration=86400, # 24 hours in seconds
refresh_token_rotation=True,
)
Go Configuration
Create config/plinto.go
:
package config
import (
"os"
"github.com/plinto/plinto-go"
)
func NewPlintoClient() *plinto.Client \{
return plinto.New(\{
Issuer: os.Getenv("PLINTO_ISSUER"),
Audience: os.Getenv("PLINTO_AUDIENCE"),
ClientID: os.Getenv("PLINTO_CLIENT_ID"),
ClientSecret: os.Getenv("PLINTO_CLIENT_SECRET"),
RedirectURI: os.Getenv("PLINTO_REDIRECT_URI"),
// Optional configuration
SessionDuration: time.Hour * 24,
RefreshTokenRotation: true,
\})
\}
Verification
Test Your Installation
Create a simple test to verify your installation:
JavaScript/TypeScript
import \{ plinto \} from './lib/plinto'
async function testConnection() \{
try \{
const config = await plinto.getConfiguration()
console.log('✅ Plinto connected successfully:', config.issuer)
\} catch (error) \{
console.error('❌ Connection failed:', error)
\}
\}
testConnection()
Python
from config.plinto import plinto
def test_connection():
try:
config = plinto.get_configuration()
print(f"✅ Plinto connected successfully: \{config['issuer']\}")
except Exception as error:
print(f"❌ Connection failed: \{error\}")
if __name__ == "__main__":
test_connection()
Go
package main
import (
"fmt"
"log"
"your-app/config"
)
func main() \{
client := config.NewPlintoClient()
config, err := client.GetConfiguration()
if err != nil \{
log.Fatalf("❌ Connection failed: %v", err)
\}
fmt.Printf("✅ Plinto connected successfully: %s\\n", config.Issuer)
\}
Troubleshooting
Common Issues
"Invalid client credentials"
- Verify your
PLINTO_CLIENT_ID
andPLINTO_CLIENT_SECRET
- Ensure no extra spaces in your environment variables
- Check that your application is active in the Plinto dashboard
"Invalid redirect URI"
- Ensure your redirect URI exactly matches what's configured in Plinto
- Include the full path (e.g.,
http://localhost:3000/api/auth/callback
) - For production, use HTTPS URLs
"Network connection failed"
- Check your internet connection
- Verify the
PLINTO_ISSUER
URL is correct - Ensure no firewall is blocking requests to
api.plinto.dev
"Module not found" errors
- Run
npm install
/pip install
/go mod tidy
again - Clear your package manager cache
- Check that you're using the correct package name for your framework
Getting Help
If you encounter issues:
- Check our troubleshooting guide
- Search GitHub issues
- Join our Discord community
- Contact support at support@plinto.dev
Next Steps
Now that Plinto is installed, you can:
- Follow the Quick Start Guide for immediate setup
- Learn about Authentication Patterns
- Explore Framework-Specific Guides
- Review Security Best Practices
Advanced Configuration
For production deployments and advanced features: