validateAuthToken static method
Validates authToken for login with auth token. Returns null if valid, CometChatCallsException if invalid.
Implementation
static CometChatCallsException? validateAuthToken(String? authToken) {
if (authToken == null) {
return CometChatCallsException(
ErrorCodeConstants.codeAuthTokenNull,
ErrorMessageConstants.messageCodeUserAuthTokenNull,
ErrorDetailConstants.detailAuthTokenNull,
);
}
if (authToken.trim().isEmpty) {
return CometChatCallsException(
ErrorCodeConstants.codeAuthTokenEmpty,
ErrorMessageConstants.messageCodeUserAuthTokenBlankOrEmpty,
ErrorDetailConstants.detailAuthTokenEmpty,
);
}
if (CometChatCallsUtils.containsSpace(authToken)) {
return CometChatCallsException(
ErrorCodeConstants.codeAuthTokenHasSpace,
ErrorMessageConstants.messageAuthTokenHasSpace,
ErrorDetailConstants.detailAuthTokenHasSpace,
);
}
return null;
}