-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
feat: Google OAuth for login & signup #6346
Conversation
✅ Deploy Preview for chatwoot-storybook canceled.
|
2991a89
to
3c01845
Compare
if @resource.nil? | ||
redirect_to "#{ENV.fetch('FRONTEND_URL', nil)}/app/login?error=oauth-no-user" | ||
return | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sojan-official @pranavrajs need your thoughts on this approach, to reject a login
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we show a toast when there is an error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
config/routes.rb
Outdated
@@ -1,11 +1,12 @@ | |||
Rails.application.routes.draw do | |||
# AUTH STARTS | |||
match 'auth/:provider/callback', to: 'home#callback', via: [:get, :post] | |||
# match 'auth/:provider/callback', to: 'home#callback', via: [:get, :post] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👃
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wanted to know if this route is actually used? I couldn't trace back the controller for it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding this back, yields this error, because the home_controller.rb
does not exist and it overrides the routes created by devise token auth
@sojan-official @tejaswinichile let me know if you have an idea about this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@scmmishra I think this has been initially added as a provider for Facebook messenger or Twitter. But we introduced Twitty later, and this endpoint is not used for Facebook. And as you said, the home_controller is also not present in the system.
But to make sure, please deploy this branch on staging, and check if the Facebook and twitter integrations are working. Or let me know; my Facebook account is already configured on staging.
Or if you could test it on local with ngrok, that will also work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noted, I will test it locally with ngrok
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tejaswinichile is there any docs on setting up facebook and twitter locally?
@sojan-official I've changed the base branch to a feature branch; we can merge this as required. I will work on the signup in a separate branch, will merge it to |
@sojan-official the PR is good to go by Pranav, need your review on this. @fayazara it'd be great if you could review the frontend changes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor comment. Other wise looks good to me.
|
||
def account_signup_allowed? | ||
# set it to true by default, this is the behaviour across the app | ||
ActiveModel::Type::Boolean.new.cast(ENV.fetch('ENABLE_ACCOUNT_SIGNUP', true)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's use GlobalConfigService.load('ENABLE_ACCOUNT_SIGNUP', 'false')
instead.
Chatwoot also allows configuration from UI for this flag. hence we will have to account for that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sojan-official made the changes, PTAL
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@scmmishra Frontend code looks good 🔥 .
Have left some comments for minor css changes and some input sanitazation.
app/javascript/dashboard/components/ui/Auth/GoogleOAuthButton.vue
Outdated
Show resolved
Hide resolved
app/javascript/dashboard/components/ui/Auth/GoogleOAuthButton.vue
Outdated
Show resolved
Hide resolved
app/javascript/dashboard/components/ui/Auth/GoogleOAuthButton.vue
Outdated
Show resolved
Hide resolved
app/javascript/dashboard/routes/auth/components/Signup/Form.vue
Outdated
Show resolved
Hide resolved
app/javascript/dashboard/routes/auth/components/Signup/Form.vue
Outdated
Show resolved
Hide resolved
app/javascript/dashboard/routes/auth/components/Signup/Form.vue
Outdated
Show resolved
Hide resolved
app/javascript/dashboard/routes/auth/components/Signup/Form.vue
Outdated
Show resolved
Hide resolved
Co-authored-by: Fayaz Ahmed <15716057+fayazara@users.noreply.github.com>
@sojan-official thanks for taking care of the merge conflict. Let me know if this requires any more changes |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Description
This PR adds Google OAuth for all existing users; this will allow users to log in or signup via their Google account.
Type of change
Depends on: chatwoot/utils#18
How Has This Been Tested?
Tested locally, needs to be verified on staging
Checklist: