Method | Method detail |
---|---|
authenticateuser() | Convenient getter method to initiate User Sign In and to determine whether the user is valid to authenticate or not. |
registerUser() | Convenient setter and getter method to initiate User Registration. It also returns User information if you want to use it for the further authentication process. |
socialLogin() | Convenient getter and setter to initiate User registration using Social Sign-In. |
forgetPassword() | Convenient getter setter to initiate Forgot Password. |
changePassword() | Convenient getter and setter method to initiate change password SDK method. |
logout() | Convenient setter to initiate User logout from the SDK. |
confiq() | Convenient setter to initiate User logout from the SDK. |
isUserLogedin() | Convenient getter method to get user login status. |
getLoginType() | Convenient getter method to get user login status by social. |
checkUserNameSuggestion() | Convenient getter method to get list of user name suggestion based on provided string or name. |
deleteUserAccount() | Convenient setter and getter method which will delete logged in user account permanently from system and return success/Fail as a response. |
/**
- parameter Email: Email to check for valid user , Type: String
Password: Password to check for valid user, Type: String
firebaseToken: firebase token to send notification, Type: String
deviceID,deviceType: use to valid for valid user device. In case of guest token it also determine as MAU
fullName: full name is use to automatically create user on server, Its being used on time of autocreate true condition. Mandatory field. Type: String
autoCreate: in case of not using GluedIn authentication process please pass this value as “true” so the system knows that you are using own authentication screen and process.
- Callback : Result with JSON format as success and failure
*/
// Call userSignUp method on sign up action
Auth.sharedInstance.authenticateUser(
email: txtEmailName.text ?? "",
password: txtPassword.text ?? "",
firebaseToken: "Firebase Token" ?? "",
deviceId: "Device ID",
deviceType: "iOS/Android",
fullName: "User Name",
autoCreate: true,
success: { [weak self] result in
guard let weakSelf = self else { return }
weakSelf.showAlert(withTitle: "Alert", withMessage: result ?? "")
}, failure: { [weak self] error in
guard let weakSelf = self else { return }
weakSelf.showAlert(withTitle: "Alert", withMessage: error)
})
// Call registerUser method on sign up action
Parameter:
Email: Email to check for valid user , Type: String
Password: Password to check for valid user, Type: String
fullName: Valid user Full Name to display on profile, Type: String
Auth.sharedInstance.registerUser(
fullName: txtFullName.text ?? "",
email: txtEmail.text ?? "",
password: txtPassword.text ?? "",
userName: "User Name",
termConditionAccepted: true,
success: { [weak self] result in
guard let weakSelf = self else { return }
weakSelf.showAlert(withTitle: "Alert", withMessage: result ?? "")
}, failure: { [weak self] error in
guard let weakSelf = self else { return }
weakSelf.showAlert(withTitle: "Alert", withMessage: error)
})
// Call userSignUp method on sign up action
param: valid sign in param which return from the social app during their sign sign in process , Type: String
let socialSiginParam = SocialSiginParam(email:”Email id”,
fullName: "Full Name",
userId: "User Id",
userName: "User Name",
profileImageUrl: " Profile Image",
type: “Type of Social”,
socialType: “Social Type”,
token: “Social Token”,
termConditionAccepted: true)
Auth.sharedInstance.socialLogin(param: socialSiginParam, success: { [weak self] result in
guard let weakSelf = self else { return }
}, failure: { [weak self] error in
guard let weakSelf = self else { return }
})
/**
- parameter Email: Email to check for valid user , Type: String
*/
// Call forget method inside the forget action
Auth.sharedInstance.forgetPassword(withEmail: email, completion: { [weak self] status, message in
guard let weakSelf = self else { return }
weakSelf.isSuccess = status
print( message)
})
/* /// Method For change Password
/// - Parameters:
/// - oldpassword: Param type string
/// - newPassword: Param type string
/// - success: Respose after success
/// - failure: Respose after failure
/// - Returns: Return type void()
*/
// Call change password method inside the change password action
Auth.sharedInstance.changePassword(
oldpassword: “old Password”,
newPassword: “newPassword”) { [weak self] result in
guard let weakSelf = self else { return }
weakSelf.changePasswordObject = result
} failure: { [weak self] error in
guard let weakSelf = self else { return }
}
// Call logout method on logout action
Auth.sharedInstance.logout(completion: { [weak self] status, msg in
guard let weakSelf = self else { return }
if status ?? false {
UserDefaults.standard.set(false, forKey: "isLogin")
weakSelf.sdkInit()
} else {
//weakSelf.showAlert(withTitle: "Alert", withMessage: msg ?? "")
print(msg)
}
})
Auth.sharedInstance.config {
[weak self] response in guard let weakSelf = self else { return }
// response.data
} failure: { [weak self] error in
guard let weakSelf = self else { return }
}
/*
Bool Return to check user login status
*/
return Account.sharedInstance.isUserLoggedIn()
/*
Bool Return to check user login status
*/
return Account.sharedInstance.isSocialLogin()
/*
Will return Suggested username list
*/
/// Method for get Suggested user name based on email id
/// - Parameters:
/// - email: Param type string
/// - success: Respose after success
/// - failure: Respose after any failure with error
Auth.sharedInstance.getUserNameSuggestion(email: "User Email id") { [weak self] result in
guard let weakSelf = self else { return }
// success(result)
} failure: { [weak self] error, code in
guard let weakSelf = self else { return }
//failure(error,code)
}()
/// Method for delete loggedin user
/// - Parameters: No Parameter required, Automaticaly consider loggedin user based on Auth token
Auth.sharedInstance.deleteUserAccount { [weak self] result in
guard let weakSelf = self else { return }
// Success Handle
} failure: { [weak self] error, code in
guard let weakSelf = self else { return }
// Fail handle
}