go-gitea / gitea

Git with a cup of tea! Painless self-hosted all-in-one software development service, including Git hosting, code review, team collaboration, package registry and CI/CD
https://gitea.com
MIT License
43.53k stars 5.35k forks source link

Mastodon Oauth login is not functioning with pleroma/akkoma/newroma instances. #21710

Open chizutan5 opened 1 year ago

chizutan5 commented 1 year ago

Description

The mastodon oauth login does not function with pleroma instances, you can enter the details and it will push the user to the oauth authorisation page but it will not allow the user to authorise the client, giving the error "incorrect username or password", it will not send the user back to gitea.

I have had this problem previously with a mediawiki mastodon integration and it was solved without modifications to pleroma, pronouns.page's mastodon integration also functions with pleroma, so this isn't a problem with my instance.

Gitea Version

1.17.3

Can you reproduce the bug on the Gitea demo site?

Cannot reproduce on demo instance as I would need the administration interface to add oauth.

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

Alpine Linux

How are you running Gitea?

Alpine linux package, nginx reverse proxy, mariadb database, authing with an akkoma instance that is proven to work with other oauth integrations.

Database

MySQL

chizutan5 commented 1 year ago

It appears that the bug according to the logs is that gitea is expecting the site to provide an email for the registered user, but there is no apparent option to force gitea to use the activitypub username in place of the email, sites like pronouns.page use that same method to avoid asking for the user's emaiil.

chizutan5 commented 1 year ago

I have just tested, you can link accounts to existing user accounts that already have emails attached, and successfully log in, but cannot create them due to the email requirement gitea has, I would say this is definitely a bug

I am including the error message: OAuth2 Provider * returned empty or missing fields: [email] CreateUser: OAuth2 Provider * returned empty or missing fields: [email] router: completed GET /user/oauth2/*/callback?code=* for *:0, 500 Internal Server Error in 294.7ms @ auth/oauth.go:828(auth.SignInOAuthCallback)

@techknowlogick Are you able to take a look at this given you are the original commit author for the mastodon oauth? Since there has been no activity in two weeks and it seems like a simple fix of just taking the mastodon username (@user@instance.tld) and applying that to the email field, in the same way pronouns.page does. I will open an issue on the goth repo since this is probably fixed through an update to that.