This snippet demonstrates a simple implementation of the Discord OAuth2 login flow using JavaScript. It includes a login button that opens the Discord authentication window, a check for the redirect URI, and a request for an access token. Once the user is authenticated, their username, discriminator and id will be displayed and the login button will be removed from the view. Make sure to replace the client ID, client secret and redirect URI with your details.