Hi @Ananth Rao ,
Thanks for reaching out.
The recommended way of supporting non-interactive logins for single-page applications (SPAs) in Azure Active Directory B2C (Azure AD B2C) is to use OAuth 2.0 Authorization code flow (with PKCE). This flow allows the application to exchange an authorization code for ID tokens to represent the authenticated user and Access tokens needed to call protected APIs. In addition, it returns Refresh tokens that provide long-term access to resources on behalf of users without requiring interaction with those users.
https://learn.microsoft.com/en-us/azure/active-directory-b2c/tutorial-register-spa
Regarding your issue with ROPC, it is not recommended for production environments, and it also requires a high degree of trust in the application and carries risks that are not present in other authentication flows.
Reference to get access token using ROPC flow for API - https://stackoverflow.com/questions/74724521/non-interactive-authentication-and-authorization-in-azure-ad-b2c
Hope this will help.
Thanks,
Shweta