Skip to main content

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}/users API

Setup

  1. Signup to Parchment via Portal
  2. Setup Organisation
  3. Setup Partner integration using one of the Partner tiles
  4. Copy the credentials into your system.
Note: If you are not using the create-user API you will need a way to manually capture the Parchment 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 Endpoint
Headers:
  • x-partner-id: Your partner ID
  • x-partner-secret: Your partner secret
  • x-organization-id: Target organization ID
  • x-organization-secret: Organization secret
  • x-user-id: Parchment user ID to authenticate
  • Content-Type: application/json
Request Body:
  1. If you want to go to patient profile
  1. If you want to directly prescribe
  1. 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.
Response:

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:
401 Unauthorized:

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