SSO
Create a Contact
/v1/pub/contactus
{
"payload":{
"contact_reason_id": "1",
"name": "John Doe",
"phone": "061136693",
"email": "testPB@gmail.com",
"details": "Hello this is details.",
"platform_id": 1,
"tournament_uuid": ""
}
}
Empty
Login
/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:
Code | Error | Description |
---|---|---|
200 | OK | Successfull login. |
401 | Unauthorized | Incorrect username or password. |
412 | Precondition Failed | User has not verified/claimed their account. |
500 | Internal Server Error | Something bad happened at the server side. |
{
"payload": {
"email": "email@example.dev",
"password": "test123"
}
}
{
"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
/v1/sso/logout
{
"payload": {
"email": "jasmina@thegate.dev",
"expiration": "2023-09-11T19:28:58.244013984Z",
"token": "1f658fe5-71f6-41a0-867f-d118742231ab",
"uuid": "A1222222-4b21-4335-9d80-dde21898c5d0baa"
}
}
{
"result": {
"expiration": "2022-09-11T19:35:09.191544819Z"
}
}
Requesting Forgot Password Service
/v1/pub/request_forgot_password
Posible response codes:
Code | Error | Description |
---|---|---|
200 | OK | Successfull login. |
401 | Unauthorized | Incorrect username or password. |
412 | Precondition Failed | User has not verified/claimed their account. |
500 | Internal Server Error | Something 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.
{
"payload":{
"email":"abc@abc.com",
"custom_url": "",
"request_type":"email"
}
}
Empty
Forgot Password After Requesting
/v1/pub/forgot_password
Posible response codes:
Code | Error | Description |
---|---|---|
200 | OK | Successfull login. |
401 | Unauthorized | Incorrect username or password. |
412 | Precondition Failed | User has not verified/claimed their account. |
500 | Internal Server Error | Something bad happened at the server side. |
NOTE : email value will be validated only if token passed as path param is generated when requested forgot password by SMS.
{
"payload":{
"url":"RANDOM-URL-FROM-EMAIL-LINK",
"password": "new-password-plain-text",
"email": "random_email@email.com"
}
}
Empty
Check Is Admin Authorized
GET /v1/sso/is_admin_authorized
Register User / Create User Stub In DB
/v1/pub/register_users
If custom_url is empty, then default values will be used.
{
"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": {
"mailSent": true
}
}
Email validation
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
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
/v1/pub/resend_validation_email
**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
/sso_platform/token
{
"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
/v1/sso/refresh_token
{
"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
/sso_platform/revoke_token
{
"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
https://api.pickleball.com/v1/sso/validate_token
Empty
200 OK if USER TOKEN is valid
OR
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
/sso_platform/validate_olttoken
Validate URL
/v1/sso/validate_url/{token}
Query Parameters
Name | Description |
---|---|
this query parameter will be validated only if token passed as path param is generated when reguested forgot password by SMS |
Empty
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
/v1/roles_per_module
Query Parameters
Name | Description |
---|---|
module | string (supported only "global" value) |
Example : GET /v1/roles_per_module?module=global
Empty
{
"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"
}
]
}