How to access identity provider authentication using RestAPI calls

I am actually working with custom created login component in my Next.js project using keycloak provided Rest api calls for authentication, Now I need to extend this keycloak provided rest API authentication to identity providers also , How to achieve that?
Please suggest me