title: How do I use access token from discord oauth2 login to get user information
body: <p>I have been trying to setup my website so users can login through discord. At the moment, I have the following code:</p>
  
  <pre><code>&lt;html&gt;
      &lt;body&gt;
          &lt;?php
              session_start();
              if ($_SERVER['REQUEST_METHOD']=='POST')
                  {
                      $params = array(
                          'response_type' =&gt; 'token',
                          'client_id' =&gt; '550631359337594881',
                          'scope' =&gt; 'identify'
                      );
                      header('Location:https://discordapp.com/api/oauth2/authorize?'.http_build_query($params));
                  }
          ?&gt;
          &lt;form action="&lt;?php echo htmlspecialchars($_SERVER['PHP_SELF']); ?&gt;" method="post"&gt;
              &lt;input type="submit" value="Login"&gt;
          &lt;/form&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Which sends the user to the discord authorisation link, and then back to:</p>
  
  <pre><code>http://localhost/#access_token=TOKEN&amp;token_type=Bearer&amp;expires_in=604800&amp;scope=identify
  </code></pre>
  
  <p><em>I am working on the site through an XAMPP local server so I can use PHP, that's why it is a</em> <code>http://localhost</code></p>
  
  <p>This is all good, however my issue is that I actually don't know where I am supposed to go from here. I have the token, token type, expiry, and scope, but I don't know how I am supposed to use them.</p>
  
  <p><strong>WHAT I WANT</strong></p>
  
  <p>I want to be able to get the user's discord avatar and username, hence why I used the identify scope (more info at <a href="https://discordapp.com/developers/docs/topics/oauth2" rel="nofollow noreferrer">https://discordapp.com/developers/docs/topics/oauth2</a>). I would like it if it can be done in PHP, because I don't know how to use languages like JSON and AJAX and all that AT ALL, however if it is the only way, its better than nothing.</p>
  
  <p>Can someone please help me follow up after I receive the access token? Thanks in advance!</p>