This endpoint will be used to find (authenticate) OR create a user after a successful login on a social provider (Google, Facebook, etc.) via an SSOfied login page.
Social media providers return a special user id following a successful login through SSOfy. You can keep and match the combination of the provider name and user id to ensure uniqueness.
Consider the following specs in designing your social authentication endpoint:
URL | anything |
Method | POST |
Headers | Content-Type, Signature |
Format | JSON |
Attribute | Type | Required | Structure |
---|---|---|---|
provider | string | Yes | |
user | object | Yes | View |
ip | string | No |
Code | Description |
---|---|
200 | Success |
409 | Duplicate (Optional) |
400 | Signature/Input validation Failed |
SSOfy utilizes the HTTP Status code to verify the result.
The response must be of the type Auth Response and include the user
object.
You receive the exact user id provided by the social provider in the request, but after you create the entry in your database, you can return your own id in place of the user's id
in the response, which can undoubtedly differ from the id
in the request.