Auth failed while using Linkedin OAuthv2 service with Gitea #10226

Closed
opened 2025-11-02 09:01:32 -06:00 by GiteaMirror · 3 comments
Owner

Originally created by @echo-cool on GitHub (Feb 6, 2023).

Description

I am trying to use Linkedin OAuth service with my Gitea instance. However, after the callback URL been called, and 500 error showed up.
ca7f371cfd0d77fe27cb43231b16f5e
image

image

gitea     | 2023/02/07 00:58:17 [63e131a9] router: completed GET /user/oauth2/Linkedin for 218.12.xxx.xxx:0, 307 Temporary Redirect in 1.5ms @ auth/oauth.go:843(auth.SignInOAuth)
gitea     | 2023/02/07 00:58:21 ...rs/web/auth/oauth.go:914:SignInOAuthCallback() [E] [63e131aa] UserSignIn: Non-200 response from UserInfo: 451, WWW-Authenticate=
gitea     | 2023/02/07 00:58:21 ...s/context/context.go:220:HTML() [D] [63e131aa] Template: status/500
gitea     | 2023/02/07 00:58:21 [63e131aa] router: completed GET /user/oauth2/Linkedin/callback?code=AQRmS7XZzHCDNobqQ5DxvGMravJUxU31jG8ujJeD9rX38vV5hqWCYqshg_J88gbBL1xpXJ5R5ZDD510WeXI4wYNfzpFEUr8VIX3xv7gjeZGmFtSxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&state=082a2f81-b1ce-46b6-bc78-xxxxxxxxxx for 218.12.xx.xxx:0, 500 Internal Server Error in 3430.9ms @ auth/oauth.go:877(auth.SignInOAuthCallback)

Gitea Version

1.18.3

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

docker

Database

SQLite

Originally created by @echo-cool on GitHub (Feb 6, 2023). ### Description I am trying to use Linkedin OAuth service with my Gitea instance. However, after the callback URL been called, and 500 error showed up. <img width="1037" alt="ca7f371cfd0d77fe27cb43231b16f5e" src="https://user-images.githubusercontent.com/99575746/217035188-4debf20b-685e-4fe5-b54b-f9230701465f.png"> <img width="1276" alt="image" src="https://user-images.githubusercontent.com/99575746/217035688-963349c3-a812-4f93-adfe-21332719b879.png"> ![image](https://user-images.githubusercontent.com/99575746/217035543-1b2510ce-1022-4f48-8b0f-59b0fadb5eee.png) ``` gitea | 2023/02/07 00:58:17 [63e131a9] router: completed GET /user/oauth2/Linkedin for 218.12.xxx.xxx:0, 307 Temporary Redirect in 1.5ms @ auth/oauth.go:843(auth.SignInOAuth) gitea | 2023/02/07 00:58:21 ...rs/web/auth/oauth.go:914:SignInOAuthCallback() [E] [63e131aa] UserSignIn: Non-200 response from UserInfo: 451, WWW-Authenticate= gitea | 2023/02/07 00:58:21 ...s/context/context.go:220:HTML() [D] [63e131aa] Template: status/500 gitea | 2023/02/07 00:58:21 [63e131aa] router: completed GET /user/oauth2/Linkedin/callback?code=AQRmS7XZzHCDNobqQ5DxvGMravJUxU31jG8ujJeD9rX38vV5hqWCYqshg_J88gbBL1xpXJ5R5ZDD510WeXI4wYNfzpFEUr8VIX3xv7gjeZGmFtSxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&state=082a2f81-b1ce-46b6-bc78-xxxxxxxxxx for 218.12.xx.xxx:0, 500 Internal Server Error in 3430.9ms @ auth/oauth.go:877(auth.SignInOAuthCallback) ``` ### Gitea Version 1.18.3 ### Can you reproduce the bug on the Gitea demo site? Yes ### Log Gist _No response_ ### Screenshots _No response_ ### Git Version _No response_ ### Operating System _No response_ ### How are you running Gitea? docker ### Database SQLite
GiteaMirror added the topic/authenticationissue/needs-feedbacktype/bug labels 2025-11-02 09:01:32 -06:00
Author
Owner

@techknowlogick commented on GitHub (Feb 6, 2023):

UserSignIn: Non-200 response from UserInfo: 451 HTTP ERROR 451 means unavailable for legal reasons.

Are you able to use the example from our upstream library https://github.com/markbates/goth to see more details about is what being returned, as I suspect linkedin may be blocking certain replies

@techknowlogick commented on GitHub (Feb 6, 2023): `UserSignIn: Non-200 response from UserInfo: 451` HTTP ERROR 451 means unavailable for legal reasons. Are you able to use the example from our upstream library https://github.com/markbates/goth to see more details about is what being returned, as I suspect linkedin may be blocking certain replies
Author
Owner

@echo-cool commented on GitHub (Feb 7, 2023):

Thanks for your reply. I downloaded that library and find out that the reason for that 451 ERROR is that the server is hosted on Tencent cloud and the IP address locates in China. I suppose Linkedin has blocked this IP range.

@echo-cool commented on GitHub (Feb 7, 2023): Thanks for your reply. I downloaded that library and find out that the reason for that 451 ERROR is that the server is hosted on Tencent cloud and the IP address locates in China. I suppose Linkedin has blocked this IP range.
Author
Owner

@techknowlogick commented on GitHub (Feb 7, 2023):

Thanks for debugging and getting that additional information. I will close this issue.
In case you have an IP in a different region, you might be able to use a proxy to support linkedin login (more information here: https://docs.gitea.io/en-us/config-cheat-sheet/#proxy-proxy)

@techknowlogick commented on GitHub (Feb 7, 2023): Thanks for debugging and getting that additional information. I will close this issue. In case you have an IP in a different region, you might be able to use a proxy to support linkedin login (more information here: https://docs.gitea.io/en-us/config-cheat-sheet/#proxy-proxy)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#10226