Partner SSO Implementation Guide
This guide covers implementing server-to-server SSO authentication to allow your users to seamlessly access Parchment Portal without re-entering credentials.Prerequisites
- Valid partner credentials (partner_id, partner_secret, organization_id, organization_secret)
- User must exist in Parchment, create either via Parchment portal or via
/organizations/{organizationId}/usersAPI
Setup
- Signup to Parchment via Portal
- Setup Organisation
- Setup Partner integration using one of the Partner tiles
- Copy the credentials into your system.
user_id of the user, in your system.
Implementation Steps
1. Initiate SSO Token
Make a server-to-server API call to generate an SSO token:🚀 API EndpointHeaders:
x-partner-id: Your partner IDx-partner-secret: Your partner secretx-organization-id: Target organization IDx-organization-secret: Organization secretx-user-id: Parchment user ID to authenticateContent-Type: application/json
- If you want to go to patient profile
- If you want to directly prescribe
- For Embedded iFrame Integration - use
/embed/prefix
Embedded iFrame Integration: If you want to embed Parchment Portal directly into your website using an iframe, use the
/embed/ prefix in your redirect path. This optimizes the page for iframe display by removing navigation elements. See the Embedded iFrame Integration Guide for complete implementation details.2. Open Parchment Portal
Create a button to open Parchment Portal in a new tab:3. User Authentication
- User is automatically authenticated in Parchment Portal
- After successful authentication ,user is redirected to the specified
redirect_path - Session is established for the user’s Parchment account
Important Security Notes
Token Expiry
- SSO tokens expire in 5 minutes
- Generate new tokens for each SSO attempt
Server-Side Only
- 🚨Never expose partner credentials to client-side code
- SSO token generation must happen on your backend server
- Only redirect URLs should be sent to the client
User Validation
- Ensure the user_id corresponds to a valid user in your system
- Verify user permissions before generating SSO tokens
- Log all SSO attempts for audit purposes
Error Handling
Common Error Responses
400 Bad Request:Error Handling Best Practices
- Always validate API responses before redirecting users
- Implement fallback authentication method if SSO fails
- Display user-friendly error messages
- Log errors for troubleshooting
Implementation Example
Support
For implementation assistance or troubleshooting:- Review API logs for detailed error messages
- Contact Parchment support with specific error responses
- Include request/response examples when reporting issues

