I have 2 different applications: say Application1 and Application2.
I have integrated Application2 with keyc
In the Application2, you have used a grant type called The Authorization Code grant; it is one of several grant types which specified by the OAuth framework.
The method through which Application1 can gain the Access Token is called password Grant, this grant is no longer recommended to be used except if you trust your app.
You can find out here the different strategies use to get integration of keycloak with a javascript app in the right way