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 oauth #3884

Merged
merged 4 commits into from
Sep 11, 2023
Merged

Google oauth #3884

merged 4 commits into from
Sep 11, 2023

Conversation

xudaotutou
Copy link
Contributor

@xudaotutou xudaotutou commented Sep 11, 2023

🤖 Generated by Copilot at 5f6ef84

Summary

✨♻️🔒

The pull request adds support for Google OAuth login in the frontend, along with custom icon components for the OAuth login buttons. It also refactors some existing code to use a common type for OAuth providers and to simplify the OAuth callback logic. The main files affected are useAuthList.tsx, callback.tsx, session.ts, system.ts, user.ts, and google/index.ts. The pull request also removes some unused and redundant code from signin/index.tsx and signin.tsx.

We're sailing on the web with OAuth, me hearties
We've added Google login to our app, me hearties
So heave away the code and pull the icons, one, two, three
And sing along the shanty of the OauthProvider, me hearties

Walkthrough

  • Create new icon components for GitHub, Google, and WeChat using SVG and Icon from @chakra-ui/react (link, link, link)
  • Refactor useAuthList hook to use icon components and add Google OAuth button (link, link, link, link)
  • Remove unused imports, variables, and parameters from SigninPage and Callback components (link, link, link, link, link, link)
  • Create new API handler for Google OAuth callback in frontend/desktop/src/pages/api/auth/oauth/google/index.ts (link)
  • Update getEnv API handler to include Google OAuth environment variables and check if Google OAuth is enabled (link, link, link, link)
  • Handle error cases in Callback component by redirecting to /signin page if OAuth login fails (link)
  • Create new function enableGoogle in frontend/desktop/src/services/enable.ts to check Google OAuth environment variables (link)
  • Use new type OauthProvider in frontend/desktop/src/stores/session.ts and frontend/desktop/src/types/user.ts to represent OAuth providers (link, link, link, link, link)
  • Add google_client_id and needGoogle properties to LoginProps type in frontend/desktop/src/types/system.ts (link, link)

@sealos-ci-robot
Copy link
Member

sealos-ci-robot commented Sep 11, 2023

🤖 Generated by lychee action

Summary

Status Count
🔍 Total 932
✅ Successful 392
⏳ Timeouts 0
🔀 Redirected 0
👻 Excluded 539
❓ Unknown 0
🚫 Errors 0

Full action output

Full Github Actions output

@codecov
Copy link

codecov bot commented Sep 11, 2023

Codecov Report

Patch has no changes to coverable lines.

📢 Thoughts on this report? Let us know!.

@pull-request-size
Copy link

Whoa! Easy there, Partner!

This PR is too big. Please break it up into smaller PRs.

@@ -211,19 +211,22 @@ Open [http://localhost:3000](http://localhost:3000) with your browser to see the
```bash
Copy link
Collaborator

Choose a reason for hiding this comment

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

It does not belong to the bash command, so leave it blank

// code = locationMap.get('access_token') ?? ''
// state = locationMap.get('state') ?? ''
} else {
throw new Error('provider error');
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

const {data, code, state} = await (async() => {
return {
data,
....
}
})()

@c121914yu c121914yu merged commit 987fb12 into labring:main Sep 11, 2023
21 of 22 checks passed
bxy4543 pushed a commit to bxy4543/sealos that referenced this pull request Oct 13, 2023
* f;eat(desktop): google oauth

* style: add google icon

* fix: icon type

* fix: clean some error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants