Go to the Azure Portal. Navigate to Azure Active Directory > App registrations > your app. Under Authentication, add http://localhost:8080/callback to the list of Redirect URIs. Save the changes. After this, your code will work as expected.