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

Google Cal return 401 if permissions not given #4616

Merged
merged 1 commit into from
Sep 20, 2022

Conversation

joeauyeung
Copy link
Contributor

What does this PR do?

This PR returns a 401 error when a user is connecting a Google Calendar but does not give the proper permissions. This was creating null credentials and breaking the connected calendars screen.

Fixes # (issue)

Environment: Staging(main branch) / Production

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How should this be tested?

  • Go to connect a Google Calendar
  • Do not check off the permissions and hit continue

Checklist

  • I haven't added tests that prove my fix is effective or that my feature works
  • I haven't checked if new and existing unit tests pass locally with my changes

@vercel
Copy link

vercel bot commented Sep 20, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
cal ✅ Ready (Inspect) Visit Preview Sep 20, 2022 at 8:14AM (UTC)

@@ -38,6 +38,8 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
const token = await oAuth2Client.getToken(code);

key = token.res?.data;

if (!key) res.status(401).json({ message: "Permissions not granted" });
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (!key) res.status(401).json({ message: "Permissions not granted" });
if (!key) return res.status(401).json({ message: "Permissions not granted" });

@zomars zomars merged commit 7e65d5d into main Sep 20, 2022
@zomars zomars deleted the hotfix/google-cal-return-404-on-null branch September 20, 2022 08:22
emrysal added a commit that referenced this pull request Sep 20, 2022
* fix isSelectedProp for settings/calendars switches (#4589)

* Hotfix/ Embed Tabs (#4593)

* Fixing installed app navigation (#4595)

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

* Embed width increase to allow preview to work in desktop mode (#4547)

* fixed settings teams rewrite

* fixed 404 signup page (#4603)

* New Crowdin translations by Github Action (#4599)

Co-authored-by: Crowdin Bot <support+bot@crowdin.com>

* Fix event type navigation (#4565)

* Fix event type navigation

* Fix dropdown focus styling

* Fix border radius

* Remove stray classname

Co-authored-by: Peer Richelsen <peeroke@gmail.com>
Co-authored-by: Joe Au-Yeung <65426560+joeauyeung@users.noreply.github.com>

* typo in /more (#4610)

Co-authored-by: gitstart <gitstart@users.noreply.github.com>
Co-authored-by: Nitesh Singh <nitesh.singh@gitstart.dev>
Co-authored-by: Matheus Muniz <matheusmuniz100@hotmail.com>
Co-authored-by: Olusanya Timothy <48022904+seunexplicit@users.noreply.github.com>
Co-authored-by: Grace Nshokano <grace.devolop@gmail.com>
Co-authored-by: Thiago Nascimbeni <tnascimbeni@gmail.com>
Co-authored-by: Matheus Muniz <87545749+matheusmuniz03@users.noreply.github.com>
Co-authored-by: Alex van Andel <me@alexvanandel.com>

* Return 401 on null keys (#4616)

* Fix wrong team link (#4620)

* Fixes #4380 (#4615)

* fix: positioning of arrows (#4478)

Co-authored-by: Alex van Andel <me@alexvanandel.com>
Co-authored-by: Peer Richelsen <peeroke@gmail.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

* Fixes #4606 - Add guests cannot be removed (#4609)

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

* feat: animate event list while reordering (#4611)

* fix: prevent waiting while invalidating

* feat: add auto animate

* static postion is added to animation container because auto animate adding
a inline style of position relative, which breaks arrow buttons
position.

* fix: wait until query get cancelled

* fix: set querydata correctly

Co-authored-by: Alex van Andel <me@alexvanandel.com>

Co-authored-by: alannnc <alannnc@gmail.com>
Co-authored-by: Hariom Balhara <hariombalhara@gmail.com>
Co-authored-by: Leo Giovanetti <hello@leog.me>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Crowdin Bot <support+bot@crowdin.com>
Co-authored-by: Afzal Sayed <14029371+afzalsayed96@users.noreply.github.com>
Co-authored-by: Joe Au-Yeung <65426560+joeauyeung@users.noreply.github.com>
Co-authored-by: GitStart <1501599+gitstart@users.noreply.github.com>
Co-authored-by: gitstart <gitstart@users.noreply.github.com>
Co-authored-by: Nitesh Singh <nitesh.singh@gitstart.dev>
Co-authored-by: Matheus Muniz <matheusmuniz100@hotmail.com>
Co-authored-by: Olusanya Timothy <48022904+seunexplicit@users.noreply.github.com>
Co-authored-by: Grace Nshokano <grace.devolop@gmail.com>
Co-authored-by: Thiago Nascimbeni <tnascimbeni@gmail.com>
Co-authored-by: Matheus Muniz <87545749+matheusmuniz03@users.noreply.github.com>
Co-authored-by: Alex van Andel <me@alexvanandel.com>
Co-authored-by: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com>
Co-authored-by: Nafees Nazik <84864519+G3root@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants