Skip to main content

Authentication

The Pulse API uses JWT-based authentication. All authenticated endpoints require a valid access token in the Authorization header.

Endpoints

POST /v1/auth/social/authenticate
GET /v1/auth/token/verify
POST /v1/auth/token/refresh

Social Authenticate

Authenticates a user via Google OAuth, validates the ID token, and returns access and refresh tokens.

Endpoint: POST /v1/auth/social/authenticate

Request Headers:

HeaderValue
Content-Typeapplication/json

Request Body:

FieldTypeRequiredDescription
responseTypestring✅ YesResponse type (e.g., "token")
grantTypestring✅ YesGrant type (e.g., "authorization_code")
identifierstring✅ YesGoogle ID token from OAuth flow
idProviderstring✅ YesIdentity provider (e.g., "google")
resourcesstring[]✅ YesArray of resource scopes (e.g., ["pulse"])

Example Request:

POST /v1/auth/social/authenticate
Content-Type: application/json

{
"responseType": "token",
"grantType": "authorization_code",
"identifier": "google-id-token",
"idProvider": "google",
"resources": ["pulse"]
}

Response:

{
"accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"expiresIn": 3600,
"idToken": "eyJhbGciOiJSUzI1NiIsImtpZCI6IjEyMzQ1NiJ9...",
"refreshToken": "refresh-token-12345",
"tokenType": "Bearer"
}

Response Fields:

FieldTypeDescription
accessTokenstringJWT access token for API authentication
expiresInnumberToken expiration time in seconds
idTokenstringIdentity token containing user information
refreshTokenstringToken used to obtain new access tokens
tokenTypestringToken type (always "Bearer")

Verify Auth Token

Verifies if the provided authorization token is valid and not expired.

Endpoint: GET /v1/auth/token/verify

Request Headers:

HeaderValue
authorizationBearer {accessToken}

Example Request:

GET /v1/auth/token/verify
authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...

Response:

{
"isAuthTokenValid": true
}

Response Fields:

FieldTypeDescription
isAuthTokenValidbooleantrue if token is valid, false otherwise

Refresh Token

Obtains a new access token using a valid refresh token. Use this endpoint when your access token has expired.

Endpoint: POST /v1/auth/token/refresh

Request Headers:

HeaderValue
Content-Typeapplication/json

Request Body:

FieldTypeRequiredDescription
refreshTokenstring✅ YesRefresh token obtained from initial authentication

Example Request:

POST /v1/auth/token/refresh
Content-Type: application/json

{
"refreshToken": "refresh-token-12345"
}

Response:

{
"accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"expiresIn": 3600,
"refreshToken": "refresh-token-12345",
"tokenType": "Bearer"
}

Response Fields:

FieldTypeDescription
accessTokenstringNew JWT access token
expiresInnumberToken expiration time in seconds
refreshTokenstringRefresh token (may be rotated)
tokenTypestringToken type (always "Bearer")