Authentication with the Auth module
Below are the steps for authenticate app using the auth module:
Step 1: Download and add the necessary files:
download the necessary file with the link “Add the link here“ and add them in to your project directory.
Step 2: Design and Create the UX/UI classes:
Design and Create the UX/UI classes as per your requirement for the help we have given sample file in the downloaded folder (Link are provided above).
Step 3: call the API public method with required parameter:
Below are the listed api public method which is available in GluedIn Core SDK for different purpose.
Sign-In
As a developer, For Sign-In and Sign-up you need to call below open public method in order to authenticate in the system.
Login:
public func authenticateUser(
email: String,
password: String,
firebaseToken: String,
fullName: String = "",
profileImageUrl: String = "",
userType: String = "",
autoCreate: Bool = false,
termConditionAccepted: Bool,
metaKeys: String? = "",
success: @escaping (UserData?) -> (),
failure: @escaping (String, Int) -> ()
) -> ()
This method will return the user data model in the success response which as a developer you need to handle and write the business logic accordingly.
In Failure: This method will return the error code error message which as a developer you need to handle according to your requirement.
Register User:
As a developer, For registering new user you need to call below open public method in order to register new user in the system.
public func registerUser(
fullName: String,
email: String,
password: String,
userName: String,
termConditionAccepted: Bool,
metaKeys: String? = "",
invitationCode: String,
success: @escaping (String?) -> (),
failure: @escaping (String, Int) -> ()
) -> ()
As a developer, you need to check the success message string, and shows message to the user according to the response which you are getting in success message.
In Failure: This method will return the error code error message which as a developer you need to handle according to your requirement.
After Register you need to call the authenticate method to login user inside the system.
Forget Password:
As a developer, you should give an option to the user to renew his/her password if he/she forget his/her password. as a developer you should call the below method and pass the email id in below mention method.
public func forgotPassword(withEmail email: String,
completion: @escaping (_ status: Bool?, _ error: String?) -> (),
failure: @escaping (String, Int) -> ()) -> ()
Change Password:
As a developer, you should give an option to the user to change the password.
public func changePassword(oldpassword: String,
newPassword: String,
success: @escaping (APiResponseModel) -> (),
failure: @escaping (String) -> ()) -> ()
Logout:
As a developer, you should give option to the user if he/she wanted to logout user from the system.
public func logout(
completion: @escaping (_ status: Bool?,
_ msg: String?) -> ()) -> ()
Get User Name Suggestion:
This method will give couple of user name suggestion which will help to choose new unique user for the login.
public func getUserNameSuggestion(
email: String,
success: @escaping (DataModel) -> (),
failure: @escaping (String, Int) -> ())
Delete user from the system:
This method will empower developer if he wanted to facilitate his user to delete his own account.
public func deleteUserAccount(
success: @escaping (APiResponseModel) -> (),
failure: @escaping (String, Int) -> ())