title: Spring Boot MultiValueMap parameters in Postman
body: <p>I have implemented OAuth2 in Spring boot. It works well when testing it in JUnit but I always get unauthorized when I try the API in postman.</p>
  
  <p>test function in JUnit:</p>
  
  <pre><code>private String obtainAccessToken(String username, String password) throws Exception {
      final MultiValueMap&lt;String, String&gt; params = new LinkedMultiValueMap&lt;&gt;();
      params.add("grant_type", "password");
      params.add("client_id", CLIENT_ID);
      params.add("username", username);
      params.add("password", password);
  
  
      ResultActions result = mockMvc.perform(post("/oauth/token")
              .params(params)
              .with(httpBasic(CLIENT_ID, CLIENT_SECRET))
              .accept(CONTENT_TYPE))
              .andExpect(status().isOk())
              .andExpect(content().contentType(CONTENT_TYPE));
  
  
      String resultString = result.andReturn().getResponse().getContentAsString();
  
      JacksonJsonParser jsonParser = new JacksonJsonParser();
      return jsonParser.parseMap(resultString).get("access_token").toString();
  }
  </code></pre>
  
  <p>I tried following APIs in postman: </p>
  
  <p>POST type <code>http://localhost:8080/oauth/token</code> with content type <code>application/json</code>
  in Body section I selected raw and JSON :</p>
  
  <pre><code>{
      "grant_type":"password",
      "client_id":"clientIdPassword",
      "username":"a",
      "password":"a"
  }
  </code></pre>
  
  <p>It showed 401 Unauthorized. Then I also tried like this :</p>
  
  <p>Post type with content type <code>application/json</code>, <code>http://localhost:8080/oauth/token?grant_type=password&amp;client_id=clientIdPassword&amp;username=a&amp;password=a</code>. This also showed 401 Unauthorized.</p>
  
  <p>My question is how can I set <code>MultiValueMap</code> as parameter in Postman?</p>