title: "Access is denied due to invalid credentials" REST API error. How to solve?
body: <p>I followed the documentation <a href="https://www.ibm.com/watson/developercloud/personality-insights/api/v3/?java#introduction" rel="nofollow noreferrer">here</a>: and <a href="https://console.bluemix.net/services/personality_insights/b6ccc311-635d-4f19-ae1d-7f6ba9312b29?paneId=gettingStarted&amp;ace_config=%7B%22region%22%3A%22us-south%22%2C%22orgGuid%22%3A%2285617358-5a0a-42fb-b56a-d16510af1711%22%2C%22spaceGuid%22%3A%22e3a155ea-4a64-41ea-adff-d79c494d9888%22%2C%22redirect%22%3A%22https%3A%2F%2Fconsole.bluemix.net%2Fdashboard%2Fapps%22%2C%22bluemixUIVersion%22%3A%22v6%22%7D&amp;env_id=ibm%3Ayp%3Aus-south" rel="nofollow noreferrer">here</a>: Trying to integrate to a Personality Insights service via Android Java. 
  However, after the app runs, and using the correct username and password as mentioned in the guide... (the guide is not clear (2nd bullet point in "Before you begin") on which set of credentials to use - It says get the "service credentials" and credentials from the new service created - I tried with both and both fail with the same error below.)</p>
  
  <p><strong>Error:</strong></p>
  
  <p>12-11 01:49:56.201 29584-29632/? I/CredentialUtils: JNDI string lookups is not available. 12-11 01:49:56.269 29584-29632/? D/NetworkSecurityConfig: No Network Security Config specified, using platform default 12-11 01:49:56.723 29584-29632/? D/OkHttp: --> POST <a href="https://gateway.watsonplatform.net/personality-insights/api/v3/profile?version=2017-10-13" rel="nofollow noreferrer">https://gateway.watsonplatform.net/personality-insights/api/v3/profile?version=2017-10-13</a> http/1.1 (1297-byte body) 12-11 01:49:56.803 29584-29632/? D/OkHttp: &lt;-- 401 Not Authorized <a href="https://gateway.watsonplatform.net/personality-insights/api/v3/profile?version=2017-10-13" rel="nofollow noreferrer">https://gateway.watsonplatform.net/personality-insights/api/v3/profile?version=2017-10-13</a> (78ms, unknown-length body) 12-11 01:49:56.863 29584-29632/? E/WatsonService: POST <a href="https://gateway.watsonplatform.net/personality-insights/api/v3/profile?version=2017-10-13" rel="nofollow noreferrer">https://gateway.watsonplatform.net/personality-insights/api/v3/profile?version=2017-10-13</a>, status: 401, error: Not Authorized 12-11 01:49:56.865 29584-29632/? E/ERROR: Unauthorized: Access is denied due to invalid credentials</p>
  
  <p>com.ibm.watson.developer_cloud.service.exception.UnauthorizedException: Unauthorized: Access is denied due to invalid credentials at com.ibm.watson.developer_cloud.service.WatsonService.processServiceCall(WatsonService.java:492) at com.ibm.watson.developer_cloud.service.WatsonService$2.execute(WatsonService.java:254) at com.upen.personalityapp.MainActivity$RetrieveFeedTask.doInBackground(MainActivity.java:105) at com.upen.personalityapp.MainActivity$RetrieveFeedTask.doInBackground(MainActivity.java:87) at android.os.AsyncTask$2.call(AsyncTask.java:306) at java.util.concurrent.FutureTask.run(FutureTask.java:237) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:244) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607) at java.lang.Thread.run(Thread.java:761) 12-11 01:49:56.866 29584-29584/?</p>
  
  <p>This is the code I am using; I am trying to pass a "text" input to the service. </p>
  
  <pre><code>        service = new PersonalityInsights("2017-10-13");
          service.setUsernameAndPassword("{myUsername}", "{myPassword}");
          Profile profile = service.getProfile(text).execute();
          System.out.println(profile);
          return profile.toString();
  </code></pre>
  
  <p>I am using the <code>com.ibm.watson.developer_cloud:personality-insights:3.8.0</code> dependency. </p>
  
  <p>I tried connecting to the URL in the error (<a href="https://gateway.watsonplatform.net/personality-insights/api/v3/profile?version=2017-10-13" rel="nofollow noreferrer">https://gateway.watsonplatform.net/personality-insights/api/v3/profile?version=2017-10-13</a> ) via a browser. It prompts for a username/password combo. I entered my details from my IBM Cloud Lite service but it throws the HTTP Error 405. Is this how it's supposed to work on the browser?</p>