Auth.js (next-auth)
Simple ID OAuth Provider Integration Guide for Auth.js
This guide explains how to integrate Simple ID as a custom OAuth 2.0 provider in your Auth.js (NextAuth.js) application.
Prerequisites
Node.js 16.13.0 or later
An Auth.js project set up in your application
A registered application in Simple ID with:
Client ID
Client Secret
Configured redirect URIs
Implementation Steps
1. Install Required Dependencies
2. Create Custom Provider Configuration
Create a new file simple-id.ts
in your project's auth providers directory:
3. Configure Auth.js
Update your Auth.js configuration file ([...nextauth].ts
or similar):
4. Environment Configuration
Add the following variables to your .env.local
file:
5. Add Sign-in Button
Add the sign-in button to your React component:
Available Scopes
Simple ID supports the following scopes:
openid
email
offline_access
app:read
app:write
app.address:read
app.address:write
app.cryptocurrency:read
app.cryptocurrency:write
billing:read
invoice:read
product:write
Error Handling
Add error handling in your Auth.js configuration:
Security Considerations
Always store sensitive credentials in environment variables
Enable PKCE (Proof Key for Code Exchange) for added security
Implement proper error handling and logging
Use HTTPS in production
Regularly rotate your client secrets
Debugging Tips
Enable debug mode in Auth.js:
Check the browser console and server logs for error messages
Verify your redirect URIs are correctly configured in Simple ID
Ensure all required scopes are properly requested
Additional Resources
Simple ID Documentation (Add your documentation URL)
Last updated