Calendar: Additional Scope enforced to be requested when it is not needed
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- java
- Lĩnh vực
- api, authentication
Hướng nghiên cứu
Bắt đầu bằng cách lần theo luồng GoogleSignInOptions requestScopes(CalendarScopes.CALENDAR_EVENTS_READONLY) đến UserRecoverableAuthIOException và recovery Intent. So sánh hành vi đó với scope của Calendar events.list được ghi lại trong tài liệu tham chiếu bên ngoài; hoàn tất khi việc liệt kê các sự kiện bằng scope readonly không yêu cầu scope calendar rộng hơn.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Environment details
- Specify the API at the beginning of the title. Calendar API
- OS type and version: Android target SDK 33
- Java version: Android 13
- version(s): com.google.apis:google-api-services-calendar:v3-rev20230707-2.0.0
Steps to reproduce
- Sign-In to Google and request Scope CALENDAR_EVENTS_READONLY =
https://www.googleapis.com/auth/calendar.events.readonly" - Retrieve the Calendar Events List for a certain CalendarID
- Get warning [GoogleAuthUtil] isUserRecoverableError status: NEED_REMOTE_CONSENT, which triggers exception UserRecoverableAuthIOException
- Upon handling exception, Request_Permission is requesting Scope "https://www.googleapis.com/auth/calendar". This is not needed, as observed in https://developers.google.com/calendar/api/v3/reference/events/list, and selecting only the events.readonly scope
Code example (simplified)
GoogleSignInOptions mGoogleSignInOptions = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestEmail()
.requestScopes(new Scope(CalendarScopes.CALENDAR_EVENTS_READONLY)) //https://developers.google.com/identity/protocols/oauth2/scopes#calendar
.build();
// Build a GoogleSignInClient with the options specified by gso.
GoogleSignInClient mGoogleSignInClient = GoogleSignIn.getClient(MainActivity.this, mGoogleSignInOptions);
Intent signInIntent = mGoogleSignInClient.getSignInIntent();
startActivityForResult(signInIntent, SIGN_IN_REQUEST_CODE);
do {
page++;
Events events;
Log.i(appLogTAG, "Sending events request, page "+page);
events = calendarService.events().list(calendarID).execute();
List<Event> items = events.getItems();
for (Event event : items) {
//some work
}
pageToken = events.getNextPageToken();
syncToken = events.getNextSyncToken();
} while (pageToken != null);
}catch (UserRecoverableAuthIOException e) {
toastInUI("Error while retrieving data. ");
//request missing permissions
Intent intent = e.getIntent();
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
appContext.startActivity(intent);
} catch (GoogleJsonResponseException e) {
if (e.getStatusCode() == 410) {
// A 410 status code, "Gone", indicates that the sync token is invalid.
Log.e(appLogTAG,"Invalid sync token, clearing event store and re-syncing.");
} else {
throw new RuntimeException(e);
}
}catch (SocketTimeoutException e) {
Log.e(appLogTAG, "Timeout while retrieving data.");
toastInUI("Timeout while retrieving data.");
}catch (IOException e) {
Log.e(appLogTAG, "Unknown error.");
throw new RuntimeException(e);
}
Stack trace
W [GoogleAuthUtil] isUserRecoverableError status: NEED_REMOTE_CONSENT
External references such as API reference guides
Any additional information below
I have tried debugging to understand where the enforced permission request comes from without success. From the link in External References the requested Scope is enough to list all events in the Calendar.
Thanks!
- Ngôn ngữ chính
- Java
- Star
- 725
- Fork
- 394
- Merge trung bình
- 45 phút
- Pull request đã merge (30 ngày)
- 240
Hướng dẫn đóng góp
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 googleapis/google-api-java-client-services
-
priority: p3 type: docs
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 65/100
-
priority: p3 type: bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 50/100
googleapis/google-api-java-client-services#29581 · 2 bình luận ·
-
priority: p3 type: feature request
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 38/100
googleapis/google-api-java-client-services#29317 · 1 bình luận ·
-
priority: p3 type: bug
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
googleapis/google-api-java-client-services#26505 · 7 bình luận · 1 reaction ·
Tất cả issue của googleapis/google-api-java-client-services
Issue tương tự
-
area-deployment area-integrations triage:bot-seen
Độ khó 2/5 Nửa ngày Mức phù hợp với người mới 86/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
apache/flink-agents#1156 ·
-
[source-shopify] FAILED bulk operation without partialDataUrl is silently treated as successful Đang mởarea/connectors autoteam community connectors/source/shopify needs-triage team/use type/bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100