Trouble configuring oauth2 with mastodon

AI-generated summary

amit_ncert is trying to configure OAuth2 with Mastodon for Discourse login but encounters an “invalid_credentials” error despite valid credentials. After entering Mastodon credentials, the user is redirected to an authorization page with “Authorize” and “Deny” options; clicking “Authorize” triggers the error. Screenshots show the login flow, authorization prompt, and plugin settings. The error URL indicates authentication failure via the oauth2_basic strategy. Beam later asks if the issue was resolved and how.

I am just trying to integrate my oauth2 provider i.e(mastodon) for login at my discourse because all my user’s reside in mastodon. I installed oauth2 plugin in my discourse and then provide following parameters in it.
Client ID for custom OAuth2
Client Secret for custom OAuth2
Authorization URL for OAuth2
Token URL for OAuth2.
After passing above parameters when I am trying to login with my Mastodon Credentials it giving me error saying that ““Sorry, there was an error authorizing your account. Perhaps you did not approve authorization? “”.
When I checked in the logs I am getting following error::
“” (oauth2_basic) Authentication failure! invalid_credentials: OAuth2::Error,””
Though my credentials are valid I am getting that error don’t know why?
I am getting following url after entering my oauth(mastodon) credentials in disocurse:::
““https://x.metastudio.org/auth/failure?message=invalid_credentials&origin=http%3A%2F%2F10.1.0.33%3A8123%2F&strategy=oauth2_basic””

I am attaching screenshot of the credentials I used in the oauth2 plugin in discourse.It would be very nice if anybody tell me the where I am doing mistake so that I can correct it and execute that thing. Screenshots include flow of “Login Procedure”.If you looked at “Authorize deny window.png”
It is showing 2 options Authorize and Deny . When I clicked on Authorize option “error” message pops up which you can see in “error.png” image.


Did you solve this? If so, how?