Sso

SSO

Create a Contact

POST
/v1/pub/contactus
Request
{
  "payload":{
    "contact_reason_id": "1",
    "name": "John Doe",
    "phone": "061136693",
    "email": "testPB@gmail.com",
    "details": "Hello this is details.",
    "platform_id": 1,
    "tournament_uuid": ""
  }
}
Response
Empty

Login

{POST}
/v1/sso/login

Should contain a header that matches the valid token. Headers are called: “PB-API-TOKEN”, “Browser”, “BrowserVersion”, “IpAddress”, “IsMobile”, “ServerMachineName”.

browser: Which browser did the user use to log in (if mobile, which app) ? browser-version: What is the version of the user's browser (if mobile, which app version)? server-machine-name: Name of the user's device. is-mobile: Did the user use a mobile device to log in? (Boolean

Posible response codes:

CodeErrorDescription
200OKSuccessfull login.
401UnauthorizedIncorrect username or password.
412Precondition FailedUser has not verified/claimed their account.
500Internal Server ErrorSomething bad happened at the server side.
Request
{
  "payload": {
    "email": "email@example.dev",
    "password": "test123"
  }
}
Response
{
  "email": "email@example.dev",
  "expiration": "2023-09-11T19:28:58.244013984Z",
  "isCompleted": true,
  "isSuperAdmin": false,
  "token": "1f658fe5-71f6-41a0-867f-d118742231ab",
  "uuid": "A1222222-4b21-4335-9d80-dde21898c5d0baa"
}

Logout

{POST}
/v1/sso/logout
💡
This request requires header called “PB-USER-TOKEN”. This API call can be only called by the users.
Request
{
  "payload": {
    "email": "jasmina@thegate.dev",
    "expiration": "2023-09-11T19:28:58.244013984Z",
    "token": "1f658fe5-71f6-41a0-867f-d118742231ab",
    "uuid": "A1222222-4b21-4335-9d80-dde21898c5d0baa"
  }
}
Response
{
  "result": {
    "expiration": "2022-09-11T19:35:09.191544819Z"
  }
}

Requesting Forgot Password Service

POST
/v1/pub/request_forgot_password
💡
This request requires “PB-API-TOKEN” from the platforms.

Posible response codes:

CodeErrorDescription
200OKSuccessfull login.
401UnauthorizedIncorrect username or password.
412Precondition FailedUser has not verified/claimed their account.
500Internal Server ErrorSomething bad happened at the server side.

If custom_url is empty, then default values will be used.

NOTE: "request_type" can be set as "sms" or "email", depending on the service you want to use.

Request
{
  "payload":{
     "email":"abc@abc.com",
     "custom_url": "",
     "request_type":"email"
   }
}
Response
Empty

Forgot Password After Requesting

POST
/v1/pub/forgot_password

Posible response codes:

CodeErrorDescription
200OKSuccessfull login.
401UnauthorizedIncorrect username or password.
412Precondition FailedUser has not verified/claimed their account.
500Internal Server ErrorSomething bad happened at the server side.
💡
This request requires “PB-API-TOKEN” from the platforms.

NOTE : email value will be validated only if token passed as path param is generated when requested forgot password by SMS.

Request
{
  "payload":{
     "url":"RANDOM-URL-FROM-EMAIL-LINK",
     "password": "new-password-plain-text",
     "email": "random_email@email.com"
   }
}
Response
Empty

Check Is Admin Authorized

GET
GET /v1/sso/is_admin_authorized
💡
This request requires “PB-API-TOKEN” from the platforms or “PB-USER-TOKEN” from the authenticated user.

Register User / Create User Stub In DB

POST
/v1/pub/register_users
💡
This request requires “PB-API-TOKEN” from the platforms.

If custom_url is empty, then default values will be used.

Request
 {
  "payload":{
     "firstName":"Joe",
     "lastName":"Smith",
     "phone":"061136693",
     "email":"aabcde@cdb.com",
     "password":"plain-password-text",
     "phoneCountryId":1,
     "gender":F,
     "custom_url": "https://ssov2.pickleball.com/verify_email",
     "country_id": 231,
     "state_id": 1023,
     "zip": 11000,
     "dob":"2024-01-03T22:47:18.968732Z"
  }
}
Response
{
    "response": {
        "mailSent": true
    }
}

Email validation

💡
This request requires “PB-API-TOKEN” from the platforms.

After a successful API call to register the user, the system sends an email to the given email in request. The email contains a link to sso.pickleball.com/validate_email/RANDOM_STRING.

Upon opening the link, the SSO part of the application should send the following request to api.pickleball.com.

GET api.pickleball.com/v1/pub/validate_email/RANDOM_STRING

200 OK on success 400 BadRequest on wrong UUID provided 410 Gone if UUID is not valid anymore (expired)

Complete Profile Creation

💡
This request requires “PB-API-TOKEN” from the platforms.

When the email or phone number is validated, the user is successfully created in the system, and moved from the temporary table in the backend. Users can then login and the frontend part of the application should observe the isCompleted field in the GET response from /v1/users/:uuid and display a proper view based on that field.

For example, if isCompleted is false, then show view to complete user creation, if isCompleted true then show user profile and maybe edit view.

Every request should use the Upsert method described above, and it will be handled as an update in the backend.

Please use lookup API calls in order to populate fields correctly and apply correct database constraints. Every field should be populated, ignored fields in Upsert/Update are:

API calls to the Upsert method should contain the PB-USER-TOKEN header in order to be authenticated. That token is received after successful login.

Re-send Validation Email

POST
/v1/pub/resend_validation_email
💡
This request requires “PB-API-TOKEN” from the platforms or “PB-USER-TOKEN” from the authenticated user.
Request
 
**If custom_url is empty, then default values will be used.**
{
  "payload":{
     "email":"abc@cdb.com",
     "custom_url": "https://ssov2.pickleball.com/verify_email"
   }
}

Place Token

POST
/sso_platform/token
💡
This request requires “PB-API-TOKEN” from the platforms.
Request
{
  "payload": {
    "email": "jasmina@thegate.dev",
    "uuid": "A1222222-4b21-4335-9d80-dde21898c5d0baa",
    "token": "1f658fe5-71f6-41a0-867f-d118742231ae",
    "expiration": "2023-09-11T19:28:58.244013984Z"
  }
}

Refresh Token

POST
/v1/sso/refresh_token
💡
This request requires “PB-API-TOKEN” from the platforms.
Request
{
  "payload": {
    "email": "jasmina@thegate.dev",
    "uuid": "A1222222-4b21-4335-9d80-dde21898c5d0baa",
    "token": "1f658fe5-71f6-41a0-867f-d118742231ae",
    "expiration": "2023-09-11T19:28:58.244013984Z"
  }
}

Revoke Token

POST
/sso_platform/revoke_token
💡
This request requires “PB-API-TOKEN” from the platforms.
Request
{
  "payload": {
    "email": "jasmina@thegate.dev",
    "uuid": "A1222222-4b21-4335-9d80-dde21898c5d0baa",
    "token": "1f658fe5-71f6-41a0-867f-d118742231ae",
    "expiration": "2023-09-11T19:28:58.244013984Z"
  }
}

Validate Token

GET
https://api.pickleball.com/v1/sso/validate_token
💡
This request requires header called “PB-USER-TOKEN”. This API call can be only called by the users.
Request
Empty
Response
200 OK if USER TOKEN is valid 

OR

Response
Returns 401 Unauthorized if token is expired or missing with this message:
{
    "Code": 401,
    "Message": "User token record not found 11a9a29c-a67d-4dcb-a414-99bdef7a478b",
    "Timestamp": 1693824327,
    "RequestId": 283979445975488
}

Validate OLT Token

GET
/sso_platform/validate_olttoken
💡
This request requires “PB-API-TOKEN” from the platforms.

Validate URL

GET
/v1/sso/validate_url/{token}
💡
This request requires “PB-API-TOKEN” from the platforms.

Query Parameters

NameDescription
emailthis query parameter will be validated only if token passed as path param is generated when reguested forgot password by SMS
Request
Empty 
Response
Response will be 200 OK - if the URL is confirmed,
400 Validation does not exist - if the validation doesn't exist,
and 410 Validation record expired - if the request hasn't been confirmed in time.

Roles per Module

GET
/v1/roles_per_module
💡
This request requires “PB-API-TOKEN” from the platforms or “PB-USER-TOKEN” from the authenticated user.

Query Parameters

NameDescription
modulestring (supported only "global" value)

Example : GET /v1/roles_per_module?module=global

Request
Empty 
Response
{
    "userRoles": [
        {
            "id": "13",
            "title": "USERS_PROFILES_EDITOR",
            "inherited_ids": "1"
        },
        {
            "id": "14",
            "title": "NEWS_ADMIN",
            "inherited_ids": "1,7"
        },
        {
            "id": "1",
            "title": "USER",
            "inherited_ids": "9"
        },
        {
            "id": "9",
            "title": "REFEREE",
            "inherited_ids": ""
        },
        {
            "id": "4",
            "title": "CONTENT_CREATOR",
            "inherited_ids": "1,3"
        },
        {
            "id": "5",
            "title": "MANAGE_VIEWER",
            "inherited_ids": "1"
        },
        {
            "id": "7",
            "title": "NEWS_CREATOR",
            "inherited_ids": "1"
        },
        {
            "id": "3",
            "title": "CONTENT_CONFIRMER",
            "inherited_ids": "1"
        }
    ]
}