Endpoint
Overview
This endpoint uses Optical Character Recognition (OCR) to extract student information from a college ID card photo. It processes the image to extract the enrollment number and name, then generates a user ID in the college email format.This is an alternative authentication method that doesn’t require a pre-existing account. The system extracts credentials directly from the ID card.
Request
Content Type
Request Body
College ID card image fileSupported formats: JPG, PNG, JPEGRequirements:
- Clear, well-lit photo of the ID card
- Enrollment number must be visible (11-digit number)
- Name field must be readable
- Text should not be blurred or obscured
Response
Either
"success" or "error"Description of the operation result
Generated user ID in college email formatFormat:
<firstname>.<lastname><first3digits>@adgitmdelhi.ac.inExample: [email protected]Extracted 11-digit enrollment number from the ID card
Example Request
cURL
JavaScript with FormData
React Example
Example Responses
Success Response
200 OK
Error Responses
No Image Uploaded
400 Bad Request
Enrollment Number Not Found
400 Bad Request
Name Not Readable
400 Bad Request
OCR Processing Failed
500 Internal Server Error
How It Works
User ID Generation
Combines name and first 3 digits of enrollment numberFormat:
<firstname>.<lastname><digits>@adgitmdelhi.ac.inExample: [email protected]Best Practices
Image Quality Tips
- Lighting: Ensure good lighting without glare or shadows
- Focus: Image should be clear and in focus
- Orientation: ID card should be right-side up
- Background: Plain background improves OCR accuracy
- Resolution: Higher resolution improves text recognition
Integration Flow
Complete Authentication Flow
Technical Details
OCR Engine
- Library: Tesseract.js v6.0.1
- Language: English (
eng) - Training Data: Located at
backend/eng.traineddata
File Handling
- Uploaded images are temporarily stored in
backend/uploads/ - Files are deleted after processing (success or failure)
- Uses
multermiddleware for multipart form handling
Security Considerations
Uploaded images are immediately deleted after OCR processing to prevent storage of sensitive ID card information.
- Images are not permanently stored
- No authentication token is generated by this endpoint
- Rate limiting recommended to prevent abuse
- Validate file types on client side before upload
Related Endpoints
- Signup - Create account using extracted user ID
- Login - Login with created credentials
- Google Login - Alternative OAuth authentication