Help with Oauth2 User-Agent Flow type API Integration

I want to integrate an API that does the following authentication

The returned value is then used as a body parameter in the authentication endpoint.