OAuth Applications
Integrating Login with Pawan.Krd allows your users to authenticate using their Pawan.Krd account. By delegating authentication and accessing authorized profile information via OAuth 2.0, you can provide a seamless login experience, verify email addresses, query account balances, and fetch subscription details.
To start using OAuth 2.0, you must first register your application in the developer portal to obtain a client_id and a client_secret. When registering, you will need to specify one or more authorized redirect URIs to secure the token exchange flow.
OAuth 2.0 Specifications
Step 1: Authorization Request
To begin the authorization flow, redirect the user to the Pawan.Krd authorization endpoint. The user will be prompted to log in (if not already authenticated) and grant your application consent to access the requested scopes.
https://pawan.krd/api/oauth/authorizeQuery Parameters
client_idredirect_uriresponse_typecode.scopeopenidprofileemailbalancesubscriptionstatecode_challengecode_verifier using the method specified in code_challenge_method.code_challenge_methodS256.Example Authorization URL
https://pawan.krd/api/oauth/authorize?client_id=your_client_id&redirect_uri=https%3A%2F%2Fmyapp.com%2Fcallback&response_type=code&scope=openid%20profile%20email&state=secure_state_hereStep 2: Token Exchange
After the user successfully completes the authorization flow, the server redirects them to your redirect_uri with an authorization code parameter. Exchange this code for an access token by making a secure POST request to the token endpoint.
https://pawan.krd/api/oauth/tokenRequest Body Parameters
grant_typeauthorization_code.client_idclient_secretcoderedirect_uricode_verifiercode_challenge. The original plain text verifier.Example Response
A successful exchange returns a JSON payload containing the access token, scopes, and optional session details.
1{
2 "access_token": "at_1234567890abcdef...",
3 "token_type": "Bearer",
4 "expires_in": 3600,
5 "refresh_token": "rt_abcdef123456...",
6 "scope": "openid profile email",
7 "session_token": "st_xyz987654...",
8 "session_expires_at": "2026-08-02T15:36:31Z"
9}Step 3: Fetching User Profile
Once you obtain an access token, you can fetch the user's profile and account information. Send a GET request to the userinfo endpoint, passing the access token in the standard HTTP Authorization header.
https://pawan.krd/api/oauth/userinfoRequest Header
Authorization: Bearer at_1234567890abcdef...Profile Response Fields
The structure and fields included in the response depend entirely on the authorized scopes:
- openid: Required for OIDC compatibility. Includes the unique identifier
sub. - profile: Includes name fields and profile picture. E.g.,
name,picture. - email: Includes the primary email address and verification state. E.g.,
email,email_verified. - balance: Includes account balance information. E.g.,
balance. - subscription: Includes user subscription level, status, and expiration date. E.g.,
subscriptionobject.
1{
2 "sub": "user_987654321",
3 "name": "Pawan Kumar",
4 "email": "[email protected]",
5 "email_verified": true,
6 "picture": "https://pawan.krd/avatar.png",
7 "balance": 15.50,
8 "subscription": {
9 "plan": "Pro Developer",
10 "status": "active",
11 "expires_at": "2026-12-31T23:59:59Z"
12 }
13}