Skip to content

Can't Connect OAuth with Gitea on Server #434

@zdhd122a

Description

@zdhd122a

I'm using Gitea on a server (Ubuntu) with connections allowed only on 127.0.0.1. I use port forwarding to connect from my PC. I set up Opengist the same way (127.0.0.1 + port forwarding). However, when trying to connect Opengist to Gitea, I get the following error:

Error 400
Bad Request
Cannot complete user auth: you must select a provider.

oauth2 application create at http://127.0.0.1:3000/user/settings/applications

Image

opengist config.yml

log-level: warn

log-output: stdout,file

# Public URL to access to Opengist
external-url: "http://127.0.0.1:6157"

# Directory where Opengist will store its data. Default: ~/.opengist/
opengist-home: "/root/.opengist"

# Secret key used for session store & encrypt MFA data on database. Default: <randomized 32 bytes>
secret-key: "29 1f 3f"

# URI of the database. Default: opengist.db (SQLite) is placed in opengist-home
# SQLite:        file:/path/to/database
# PostgreSQL:    postgres://user:password@host:port/database
# MySQL/MariaDB: mysql://user:password@host:port/database
db-uri: "file:/root/.opengist/opengist.db?cache=shared&mode=rwc"

index.enabled: true

index.dirname: opengist.index

git.default-branch:

sqlite.journal-mode: WAL

http.host: "127.0.0.1"

http.port: 6157

http.git-enabled: true

ssh.git-enabled: true

ssh.host: "127.0.0.1"

ssh.port: 2222

ssh.external-domain:

ssh.keygen-executable: "ssh-keygen"

# To create a new OAuth2 application using Gitea : https://gitea.domain/user/settings/applications
gitea.client-key: "4bc"
gitea.secret: "gto_"
# URL of the Gitea instance. Default: https://gitea.com/
gitea.url: "http://127.0.0.1:3000"
# The name of the Gitea instance. It is displayed in the OAuth login button. Default: Gitea
gitea.name: "Opengist"

# To create a new OAuth2 application using OpenID Connect:
# Discovery endpoint of the OpenID provider. Generally something like http://auth.example.com/.well-known/openid-configuration
# Instance name
# Set your own custom name to be displayed instead of 'Opengist'
custom.name:

custom.logo:
custom.favicon:

# Static pages in footer (like legal notices, privacy policy, etc.)
# The path can be a URL or a relative path to a file in the $opengist-home/custom/ directory
custom.static-links:
#  - name: Gitea
#    path: https://gitea.com
#  - name: Legal notices
#    path: legal.html

logs from opengist

OG_LOG_LEVEL=info ./opengist --config config.yml
Opengist v1.9.1
Using YAML config file: /root/opengist/config.yml
Using environment variables config: OG_LOG_LEVEL
06:14:42 INF internal/cli/main.go:95 Data directory: /root/.opengist
06:14:42 INF internal/db/db.go:106 Setting up a SQLite database connection
06:14:42 INF internal/db/db.go:125 Database connection established
06:14:42 INF internal/cli/main.go:128 Index directory: /root/.opengist/opengist.index
06:14:42 INF internal/index/bleve.go:38 Indexer initialized
06:14:42 INF internal/ssh/run.go:50 Starting SSH server on ssh://127.0.0.1:2222
06:14:42 INF internal/web/server/server.go:51 Starting HTTP server on http://127.0.0.1:6157
06:14:47 INF internal/web/server/middlewares.go:48 HTTP duration=1.125201 ip=127.0.0.1 method=GET status=400 uri=/oauth/gitea/callback
06:14:47 INF internal/web/server/middlewares.go:48 HTTP duration=11.28338 ip=127.0.0.1 method=GET status=200 uri=/assets/main-742e3dff.css
06:14:47 INF internal/web/server/middlewares.go:48 HTTP duration=1.255456 ip=127.0.0.1 method=GET status=200 uri=/assets/main-33049c6e.js
06:14:47 INF internal/web/server/middlewares.go:48 HTTP duration=0.759822 ip=127.0.0.1 method=GET status=200 uri=/assets/opengist-85b89b9c.svg

at gitea app.ini i also add
[webhook]
ALLOWED_HOST_LIST = *

Nothing help

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions