How to use SMS for self-service ( forgot password)

My application uses the following piece of codes to request OKTA to send password reset message. When the Password policy enables both Email and SMS, it works fine. But I just enable SMS option, the call returns Okta E0000017 (Password reset failed - Forgot password is not allowed in the user’s current status), ErrorId oaepU0XeIE5TVydesSn1HY2vw

How do I make SMS option work?

Client client = Clients.builder().setOrgUrl(configService.getOktaDomain())
.setClientCredentials(new TokenClientCredentials(configService.getApiKey())).build();
User user = client.getUser(email);