Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OAuth方式での認証に失敗する (Invalid or expired transaction ID) #13088

Open
1 task
alfa-jpn opened this issue Jan 26, 2024 · 0 comments
Open
1 task
Labels
🐛Bug Unexpected behavior

Comments

@alfa-jpn
Copy link

💡 Summary

OAuth認証方式を利用したアプリケーションの開発を行っています。
https://misskey-hub.net/cn/docs/for-developers/api/token/oauth/

ドキュメント通りに実装を進めていますが、
アプリケーション認証フォームをブラウザで開いて認証ボタンを押したところ
Invalid or expired transaction ID というエラーが表示されて認証フローを継続できません。

misskeyの実装に疎いため以下は推測となりますが、

認証に必要なデータを MemoryKVCache を利用して保持する実装となっているため
複数のバックエンドサーバーが起動する環境下 (misskey.io 等) では個々のサーバーのみデータが保存され、
ロードバランサーが前回と同じサーバーにリクエストを振り分けないと正しく動作しないのではないかと考えています。

https://github.com/misskey-dev/misskey/blob/develop/packages/backend/src/server/oauth/OAuth2ProviderService.ts#L200

🥰 Expected Behavior

認証フローが正常に完了する。

🤬 Actual Behavior

一般的なピーク時間帯 (バックエンドサーバーが多く起動している時間帯?) では認証フローはほぼ確実に失敗する。

📝 Steps to Reproduce

  1. チャレンジコード等を準備して /oauth/authorize にアクセスします
    • misskey.io のようにバックエンドが複数存在する環境でのアクセスが必要と考えています
  2. 認証を継続します
  3. Invalid or expired transaction ID というエラーが表示されます

💻 Frontend Environment

* Model and OS of the device(s): Ubuntu 24.04
* Browser: Chrome
* Server URL: misskey.io
* Misskey:

🛰 Backend Environment (for server admin)

* Installation Method or Hosting Service:
* Misskey:
* Node:
* PostgreSQL:
* Redis:
* OS and Architecture:

Do you want to address this bug yourself?

  • Yes, I will patch the bug myself and send a pull request
@alfa-jpn alfa-jpn added the ⚠️bug? This might be a bug label Jan 26, 2024
@tamaina tamaina added 🐛Bug Unexpected behavior and removed ⚠️bug? This might be a bug labels Jan 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛Bug Unexpected behavior
Projects
Status: Triage
Development

Successfully merging a pull request may close this issue.

2 participants