Overview

The AuthController provides REST endpoints for authentication-related operations.

Endpoints

GET /auth/login/callback

Handles the login callback from the Google OIDC provider.

Request Parameters

Parameter Description

code

The authorization code received from Google OIDC

Response

Returns the following fields:

Path Type Description

accessToken

String

The access token to be used for authentication to Core API

expirationInSeconds

Number

The expiration time of the access token in seconds

Example Request

$ curl 'http://localhost:8080/auth/login/callback?code=auth-code' -i -X GET

Example Response

{"accessToken":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c","expirationInSeconds":3600}

GET /auth/me

Retrieves the details of the currently authenticated user.

Request Headers

Name Description

Authorization

Bearer token to authenticate the request

Response

Returns the following fields:

Path Type Description

sub

String

The employee ID of the user

name

String

The full name of the user

givenName

String

The first name of the user

middleName

String

The middle name of the user, if any

familyName

String

The last name of the user

picture

String

The URL of the user’s profile picture

email

String

The email address of the user

emailVerified

Boolean

Indicates whether the user’s email is verified

phoneNumber

String

The mobile number of the user

roles

Array

The list of roles assigned to the user

Example Request

$ curl 'http://localhost:8080/auth/me' -i -X GET \
    -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxIiwiZW1haWxfdmVyaWZpZWQiOmZhbHNlLCJyb2xlcyI6WyJBRE1JTiJdLCJpc3MiOiJ0ZXN0LWlzc3VlciIsImdpdmVuX25hbWUiOiJDYWxlbiIsIm1pZGRsZV9uYW1lIjoiTWlkZGxlIiwicGljdHVyZSI6Imh0dHA6Ly9leGFtcGxlLmNvbS9waWMuanBnIiwiYXVkIjoidGVzdC1hdWRpZW5jZSIsIm5hbWUiOiJDYWxlbiBMZWdhenBpIiwicGhvbmVfbnVtYmVyIjoiKzYzOTEyMzQ1Njc4OSIsImV4cCI6MTc0ODA4ODc2MSwiZmFtaWx5X25hbWUiOiJMZWdhenBpIiwiZW1haWwiOiJjYWxlbkBvcmFuZ2VhbmRicm9uemUuY29tIn0.Wou_NtzP3PrhntnN-5kedDBLR8o9dsJMQsy6VVbbtbY'

Example Response

{"sub":"1","name":"Calen Legazpi","givenName":"Calen","middleName":"Middle","familyName":"Legazpi","picture":"http://example.com/pic.jpg","email":"calen@orangeandbronze.com","emailVerified":false,"phoneNumber":"+639123456789","roles":["ADMIN"]}