[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[],[],null,["# Class ClientParametersAuthentication (1.39.0)\n\nVersion latestkeyboard_arrow_down\n\n- [1.39.0 (latest)](/java/docs/reference/google-oauth-client/latest/com.google.api.client.auth.oauth2.ClientParametersAuthentication)\n- [1.38.2](/java/docs/reference/google-oauth-client/1.38.2/com.google.api.client.auth.oauth2.ClientParametersAuthentication)\n- [1.37.0](/java/docs/reference/google-oauth-client/1.37.0/com.google.api.client.auth.oauth2.ClientParametersAuthentication)\n- [1.36.0](/java/docs/reference/google-oauth-client/1.36.0/com.google.api.client.auth.oauth2.ClientParametersAuthentication)\n- [1.34.1](/java/docs/reference/google-oauth-client/1.34.1/com.google.api.client.auth.oauth2.ClientParametersAuthentication)\n- [1.33.3](/java/docs/reference/google-oauth-client/1.33.3/com.google.api.client.auth.oauth2.ClientParametersAuthentication)\n- [1.32.1](/java/docs/reference/google-oauth-client/1.32.1/com.google.api.client.auth.oauth2.ClientParametersAuthentication) \n\n public class ClientParametersAuthentication implements HttpRequestInitializer, HttpExecuteInterceptor\n\nClient credentials specified as URL-encoded parameters in the HTTP request body as specified in\n[Client Password](http://tools.ietf.org/html/rfc6749#section-2.3.1)\n\nThis implementation assumes that the [HttpRequest#getContent()](https://cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.http.HttpRequest.html#com_google_api_client_http_HttpRequest_getContent_) is `null` or an\ninstance of UrlEncodedContent. This is used as the client authentication in [TokenRequest#setClientAuthentication(HttpExecuteInterceptor)](/java/docs/reference/google-oauth-client/latest/com.google.api.client.auth.oauth2.TokenRequest#com_google_api_client_auth_oauth2_TokenRequest_setClientAuthentication_com_google_api_client_http_HttpExecuteInterceptor_).\n\nSample usage: \n\n\n static void requestAccessToken() throws IOException {\n try {\n TokenResponse response = new AuthorizationCodeTokenRequest(new NetHttpTransport(),\n new GsonFactory(), new GenericUrl(\"https://server.example.com/token\"),\n \"SplxlOBeZQQYbYS6WxSbIA\").setRedirectUri(\"https://client.example.com/rd\")\n .setClientAuthentication(\n new ClientParametersAuthentication(\"s6BhdRkqt3\", \"7Fjfp0ZBr1KtDRbnfVdmIw\")).execute();\n System.out.println(\"Access token: \" + response.getAccessToken());\n } catch (TokenResponseException e) {\n if (e.getDetails() != null) {\n System.err.println(\"Error: \" + e.getDetails().getError());\n if (e.getDetails().getErrorDescription() != null) {\n System.err.println(e.getDetails().getErrorDescription());\n }\n if (e.getDetails().getErrorUri() != null) {\n System.err.println(e.getDetails().getErrorUri());\n }\n } else {\n System.err.println(e.getMessage());\n }\n }\n }\n \nImplementation is immutable and thread-safe. \n\nInheritance\n-----------\n\n[java.lang.Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \\\u003e ClientParametersAuthentication \n\nImplements\n----------\n\ncom.google.api.client.http.HttpRequestInitializer, com.google.api.client.http.HttpExecuteInterceptor \n\nInherited Members\n-----------------\n\n[Object.clone()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--) \n[Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-) \n[Object.finalize()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--) \n[Object.getClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--) \n[Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--) \n[Object.notify()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--) \n[Object.notifyAll()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--) \n[Object.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--) \n[Object.wait()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--) \n[Object.wait(long)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-) \n[Object.wait(long,int)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-)\n\nConstructors\n------------\n\n### ClientParametersAuthentication(String clientId, String clientSecret)\n\n public ClientParametersAuthentication(String clientId, String clientSecret)\n\nMethods\n-------\n\n### getClientId()\n\n public final String getClientId()\n\nReturns the client identifier issued to the client during the registration process.\n\n### getClientSecret()\n\n public final String getClientSecret()\n\nReturns the client secret or `null` for none.\n\n### initialize(HttpRequest request)\n\n public void initialize(HttpRequest request)\n\n### intercept(HttpRequest request)\n\n public void intercept(HttpRequest request)"]]