Social login
Login via password is not the only login supported by KDone.
Apple, Google and Facebook login is supported through userModule
DSL.
Apple
To configure login with Apple, app bundle ID must be specified in apple
configuration function inside the DSL function.
userModule<User> {
apple("<bundleID>")
}
This will open a single API for signup and login. KDone will use the e-mail provided by Apple as username and will recognise if that username is already signed up or not.
Endpoint apple/access
Method POST
Body
{
"username":"giovanni.games@icloud.com",
"name": "Giovanni",
"surname": "Games",
"nickname": "giovannigames"
}
Request headers
appleToken: <Apple token from sign in with Apple>
appleId: <Apple ID from sign in with Apple>
Result headers
Authorization: <token>
Result body
{
"username":"giovanni.games@icloud.com",
"name": "Giovanni",
"surname": "Games",
"nickname": "giovannigames",
"_id": "5dfbaa6f82ec6d71f9b2201d",
"role": null,
}
Apple social login only works with iOS apps that implement Sign in with Apple. With other clients, token should be generated by following Apple docs.
In order to configure login with Google, sign-in with Google must be configured, typically through an SDK. Check on (Google Developers website)[https://developers.google.com] for further details.
Once Google sign-in and SDK are set up, KDone can be configured to perform login with Google accounts.
userModule<User> {
google("<Google client ID>", "<Google client secret>", "<Google redirect URL>")
}
This will open a single API for signup and login. KDone will use the e-mail provided as username and will recognise if that username is already signed up or not.
Endpoint google/access
Method POST
Body
{
"username":"giovanni.games@icloud.com",
"name": "Giovanni",
"surname": "Games",
"nickname": "giovannigames"
}
Request headers
googleToken: <Google token from Google SDK>
googleId: <Google ID from Google SDK>
Result headers
Authorization: <token>
Result body
{
"username":"giovanni.games@icloud.com",
"name": "Giovanni",
"surname": "Games",
"nickname": "giovannigames",
"_id": "5dfbaa6f82ec6d71f9b2201d",
"role": null,
}
In order to configure login with Facebook, login with Facebook must be configured, typically through an SDK. Check on (Facebook Developers website)[https://developers.facebook.com] for further details.
Once Facebook login and its SDK are set up, KDone can be configured to perform login with Facebook.
userModule<User> {
Facebook("<Facebook app ID>", "<Facebook secret>")
}
This will open a single API for signup and login. KDone will use e-mail provided as username and will recognise if that username is already signed up or not.
Endpoint facebook/access
Method POST
Body
{
"username":"giovanni.games@icloud.com",
"name": "Giovanni",
"surname": "Games",
"nickname": "giovannigames"
}
Request headers
facebookToken: <Facebook token from Facebook SDK>
facebookId: <Facebook ID from Facebook SDK>
Result headers
Authorization: <token>
Result body
{
"username":"giovanni.games@icloud.com",
"name": "Giovanni",
"surname": "Games",
"nickname": "giovannigames",
"_id": "5dfbaa6f82ec6d71f9b2201d",
"role": null,
}