Google auth can be out of sync with Firebase/Popcode auth state
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 25/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Cần làm rõ
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- firebase, javascript
- Lĩnh vực
- authentication, web-dev
Hướng nghiên cứu
Bắt đầu bằng cách xem xét các luồng xác thực được mô tả ở đây, bao gồm Google OAuth, việc xử lý phiên Firebase/Popcode, thông tin đăng nhập GitHub đã lỗi thời và phần công việc Google API được lên kế hoạch trong #1511. Không có tệp hoặc bài kiểm thử nào được nêu tên, và issue đưa ra nhiều thiết kế khả thi; trước tiên hãy xác định cách tiếp cận đồng bộ hóa đã chọn cùng các tiêu chí chấp nhận của cách tiếp cận đó trước khi tìm vị trí của phần triển khai và các bài kiểm thử.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
The authentication method we’re using with the Google SDK maintains an internal global auth state, which is used to authenticate calls made with the Google client library. Currently there is no guarantee that the Google SDK’s auth state is consistent with Firebase or Popcode’s own state.
When logging in or out using Google OAuth, this generally will not be a problem; logging in authenticates us with the Google SDK, and we end the Google session when the user signs out. However, there are some other circumstances where they can get out of sync:
- Loading a Popcode environment when already logged in—Google maintains a session as well but it is likely to expire more quickly than Popcode’s own session
- Logging in using the deprecated Log In With GitHub method
As a corollary, we currently store the idToken from the Google auth response, with the intention of using it to authenticate future Google API calls. However, this token is not used for that purpose and there is no reason to store it. At a minimum, we should stop storing it, and modify business logic which assumes that the presence of an auth token is a requirement for a valid linked identity provider.
As for the overall problem, it’s currently neither here nor there because we don’t actually make any authenticated calls to a Google API. This will change with #1511 however.
I can see a number of potential solutions to the problem of keeping auth state in sync, and guaranteeing that a logged in user is able to make authenticated calls to the Google API using their linked Google credentials:
- Ensure that a logged in Popcode user always has an active session in the Google auth SDK.
- This would mean logging the user out if a new tab is opened which has an active Popcode/Firebase session but no active Google auth session. This pattern is already used to keep Popcode and Firebase session state in sync.
- We would also need to either remove the GitHub login button entirely, or refuse to let people log in using GitHub to an account that is also linked to Google.
- In general this is not a terribly appealing option because it means we are locked in to always having the user log in with Google, and our session management is at the mercy of Google’s
- Build in affordances for users initiating actions that they need further authentication in order to do. For instance if the user is logged in to Popcode with a Google-linked account, but does not actually have a Google session, and they tried to create an assignment in Classroom, we would show a Google auth dialog in order to create an active session in the Google auth SDK. For consistency, we would probably want to do the same thing with workflows that use the GitHub API.
- Switch to the stateless authentication API in the Google SDK. This is a lower-level API that does not do any session management and just allows us to initiate an OAuth flow and get some tokens back.
- This would be a significant effort, though, because the auth token returned from
authorize()is very short-lived. The higher-level API deals with periodically refreshing the token as long as a session is active, but as far as I can tell we would need to do this ourselves using the low-level API. Refreshing a token requires an API call that includes our private app secret, so we’d need to do it with server-side code; this would probably be reasonably straightforward using Firebase Cloud Functions but it would be our first time doing such a thing. - The upside is that we could use
getOfflineAccess()to get a long-lived refresh token, essentially putting us in the same situation as we are with GitHub where we are able to store an evergreen credential that we can use for API requests
- Ngôn ngữ chính
- JavaScript
- Star
- 191
- Fork
- 143
- Merge trung bình
- 4 ngày 11 giờ
- Pull request đã merge (30 ngày)
- 5
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của popcodeorg/popcode
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 30/100
popcodeorg/popcode#2522 · 1 reaction ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
popcodeorg/popcode#2520 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 45/100
popcodeorg/popcode#2519 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
popcodeorg/popcode#2517 ·
-
User Feedback Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
popcodeorg/popcode#2516 ·
Tất cả issue của popcodeorg/popcode
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
avniproject/avni-client#2135 ·
-
automated broken-link
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
-
agent/security hive/hosted-available-lke648397-260827-5n31 security
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
babalae/bettergi-scripts-list#3674 ·
-
A-Release-Notes C-Editing D-Modest S-Ready-For-Implementation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
bevyengine/bevy-website#2595 ·