From f493ccb958996a49c50ed558f642a68468528ec3 Mon Sep 17 00:00:00 2001 From: Benjamin Date: Mon, 8 May 2023 13:51:22 -0400 Subject: [PATCH] Add userinfo email scope for gcalendar plugin auth refresh to resolve 401 Signed-off-by: Benjamin --- .changeset/funny-cups-count.md | 5 +++++ plugins/gcalendar/src/hooks/useSignIn.ts | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 .changeset/funny-cups-count.md diff --git a/.changeset/funny-cups-count.md b/.changeset/funny-cups-count.md new file mode 100644 index 0000000000..19dbc3b8bf --- /dev/null +++ b/.changeset/funny-cups-count.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-gcalendar': patch +--- + +Pass user info email scope on auth refresh to resolve invalid credentials error diff --git a/plugins/gcalendar/src/hooks/useSignIn.ts b/plugins/gcalendar/src/hooks/useSignIn.ts index 351707b54e..3dbc778cf1 100644 --- a/plugins/gcalendar/src/hooks/useSignIn.ts +++ b/plugins/gcalendar/src/hooks/useSignIn.ts @@ -25,7 +25,10 @@ export const useSignIn = () => { const signIn = useCallback( async (optional = false) => { const token = await authApi.getAccessToken( - 'https://www.googleapis.com/auth/calendar.readonly', + [ + 'https://www.googleapis.com/auth/calendar.readonly', + 'https://www.googleapis.com/auth/userinfo.email', + ], { optional, instantPopup: !optional,