OAuth 2.0 Integration Guide
Integrate "Login with PQC"
Implement Single Sign-On (SSO) across any of your applications using the Parallel Quintillion Coders Identity Provider.
First, register your app in the Developer Dashboard to get your
client_id and client_secret.
1 The OAuth-like Flow
Our protocol operates similarly to standard OAuth 2.0 Authorization Code Flow. It abstracts session management away from your application so users only need to maintain one set of credentials globally.
User clicks "Login with PQC" on your App
User is redirected to PQC's `authorize.php` endpoint
PQC authenticates user, generates a 1-time `auth_code`
PQC redirects user back to your App's Callback URL with the `code`
Your App exchanges the `code` server-side for a JWT Access Token.
2 Authorization Endpoint
To initiate the login, redirect your users here:
GET http://parallelquintillioncoders.com/auth/authorize.php
| Parameter | Required | Description |
|---|---|---|
| client_id | Yes | Your application's unique ID given by PQC Admin. |
| redirect_uri | Yes | The trusted URL encoded callback endpoint on your app. |
3 Token Exchange Endpoint
Once you receive the `code` param on your callback page, exchange it server-to-server for a JWT.
POST /auth/backend/api/v1/auth/token.php
PHP Helper
// Example Callback Implementation
$code = $_GET['code'];
$ch = curl_init('http://parallelquintillioncoders.com/auth/backend/api/v1/auth/token.php');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
'client_id' => 'YOUR_CLIENT_ID',
'client_secret' => 'YOUR_SECRET_KEY',
'code' => $code
]));
$response = curl_exec($ch);
$data = json_decode($response, true);
if (isset($data['access_token'])) {
// Standard JWT contains 'user_id' and 'email' payload claims.
$_SESSION['jwt'] = $data['access_token'];
echo "Login Successful!";
}
4 Decoding the JSON Web Token (JWT)
The `access_token` you receive is a standardized JWT. You can decode it on your server using your `client_secret` to persistently identify the user across your application.
Payload Claims Included:
{
"iss": "parallelquintillioncoders.com",
"aud": "YOUR_CLIENT_ID",
"iat": 1711234567,
"exp": 1713826567,
"user_id": 1042,
"email": "user@example.com"
}
{
"iss": "parallelquintillioncoders.com",
"aud": "YOUR_CLIENT_ID",
"iat": 1711234567,
"exp": 1713826567,
"user_id": 1042,
"email": "user@example.com"
}
5 Visual Implementation
Here is the recommended button style to use on your application to trigger the "Login with pqc" flow.
Continue with pqc
<a href="http://parallelquintillioncoders.com/auth/authorize.php?client_id=YOUR_ID&redirect_uri=YOUR_URL"
class="flex items-center justify-center gap-3 px-6 py-4 bg-gray-900 border border-gray-700 text-white font-semibold rounded-xl shadow-lg hover:bg-gray-800 transition-all">
<img src="https://raw.githubusercontent.com/parallelquintillioncoders/publicData/main/pqc_green_512.png" alt="PQC Logo" class="w-5 h-5 object-contain">
Continue with pqc
</a>