Added more null checks
check if token requires ssl