title: I get the following error: "message": "Malformed access token
body: <p>I have an app in facebook and I am trying to obtain long term token,</p>
  
  <p>for that I call the following link:</p>
  
  <p><a href="https://graph.facebook.com/oauth/authorize?client_id=xxxxxx&amp;redirect_uri=http%3A%2F%2Flocalhost%3A8080%2Faccesstokforfacebook%2Ffbaccess&amp;scope=read_stream,read_insights,user_religion_politics,user_relationship_details,user_hometown,user_location,user_likes,user_activities,user_interests,user_education_history,user_work_history,user_website,user_groups,user_events,user_photos,user_videos,user_about_me,user_status,user_games_activity,user_tagged_places,user_actions.books,user_actions.video,user_actions.news" rel="nofollow noreferrer">https://graph.facebook.com/oauth/authorize?client_id=xxxxxx&amp;redirect_uri=http%3A%2F%2Flocalhost%3A8080%2Faccesstokforfacebook%2Ffbaccess&amp;scope=read_stream,read_insights,user_religion_politics,user_relationship_details,user_hometown,user_location,user_likes,user_activities,user_interests,user_education_history,user_work_history,user_website,user_groups,user_events,user_photos,user_videos,user_about_me,user_status,user_games_activity,user_tagged_places,user_actions.books,user_actions.video,user_actions.news</a></p>
  
  <p>and the return url is a servlet with following codes:</p>
  
  <pre><code>response.setContentType("text/html");       
      PrintWriter out = response.getWriter();
  
      String accessCode = request.getParameter("code");
      System.out.println("dddd  "+accessCode);
      //print SUCCESS if code is found
      /*if (accessCode!=null){*/
          out.print("&lt;!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01//EN\"\"http://www.w3.org/TR/html4/strict.dtd\"&gt;&lt;html&gt;&lt;head&gt;&lt;title&gt;Facebook Access Granted&lt;/title&gt;&lt;/head&gt;&lt;body&gt;");
          out.print("&lt;p&gt;SUCCESS!&lt;/p&gt;&lt;p&gt;"+accessCode+"&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;");
  </code></pre>
  
  <p>and this servlet receives the very long code like this:</p>
  
  <p>AQCY244eMOhxEVu3e6UEIl-qK974wTh-p0Il1ZdG9VEAYl5GdrjxxxxxxxxxxxxxxxxxxxxxxxxxxxxxQcJeUmeXFU56cbWbmXJdLQvEyIT7JWCxxu6tChkr9oCL1DVYxxv4v-j4Y_vaWGD7dYcxxxxxxxxxxxxxxxxxxTvZPHLU-tU5ySHrQrVgpo_i8minM73cyWxxxxxxxxxxxxxxdZvnrIhQXQ-B_3LAFzDcWe2NbCW7WSgmQ-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxMkJ55M0wHHbLmL4D-g_wLIwhpz4W_8Hz0h7v_ZL</p>
  
  <p>Now when I use this token to get the all info for a page I get an error:</p>
  
  <p>this is a link that I use:</p>
  
  <p><a href="https://graph.facebook.com/v2.0/khalatbari.hooman/feed?access_token=THE" rel="nofollow noreferrer">https://graph.facebook.com/v2.0/khalatbari.hooman/feed?access_token=THE</a> ABOVE CODE</p>
  
  <p>and the error is:</p>
  
  <p><img src="https://i.stack.imgur.com/R7NZu.png" alt="enter image description here"></p>
  
  <p>Now I think the code that I get is not access token but I have no idea how to use this code to get access token!!!</p>
  
  <p>can anyone help</p>