keep getting these error message when im trying to log into a server, does anyone know how to fix these?

device:mobile

mc version:1.21.124

(also it somehow works when im playing with mobile data,but not with wifi)
you need to authenticate to microsoft services error