mirror of
https://github.com/wassname/talk.git
synced 2026-08-08 11:28:12 +08:00
Merge master
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
---
|
||||
title: talk-plugin-google-auth
|
||||
permalink: /plugin/talk-plugin-google-auth/
|
||||
layout: plugin
|
||||
plugin:
|
||||
name: talk-plugin-google-auth
|
||||
depends:
|
||||
- name: talk-plugin-auth
|
||||
provides:
|
||||
- Server
|
||||
- Client
|
||||
---
|
||||
|
||||
Enables sign-in via Google+ via the server side passport middleware.
|
||||
|
||||
You will need to enable the Google+ API in the dashboard and create credentials
|
||||
for a new OAuth client ID web application. The authorized JavaScript origin
|
||||
should be set to the Talk domain, and the authorized redirect URI should be set
|
||||
to http://<example.com>/api/v1/auth/google/callback. This is only required while
|
||||
the `talk-plugin-google-auth` plugin is enabled.
|
||||
|
||||
Configuration:
|
||||
|
||||
- `TALK_GOOGLE_CLIENT_ID` (**required**) - The Google OAuth2 client ID for your
|
||||
Google login web app. You can learn more about getting a Google Client ID at
|
||||
the [Google API Console](https://console.developers.google.com/apis/).
|
||||
- `TALK_GOOGLE_CLIENT_SECRET` (**required**) - The Google OAuth2 client ID for
|
||||
your Google login web app. You can learn more about getting a Google Client
|
||||
ID at the [Google API Console](https://console.developers.google.com/apis/).
|
||||
@@ -1,3 +1,7 @@
|
||||
ar:
|
||||
talk-plugin-google-auth:
|
||||
sign_in: "تسجيل الدخول عبر حساب جوجل"
|
||||
sign_up: "اشترك عبر حساب جوجل"
|
||||
en:
|
||||
talk-plugin-google-auth:
|
||||
sign_in: "Sign in with Google"
|
||||
|
||||
@@ -24,9 +24,16 @@ module.exports = passport => {
|
||||
async (req, accessToken, refreshToken, profile, done) => {
|
||||
let user;
|
||||
try {
|
||||
user = await UsersService.findOrCreateExternalUser(profile);
|
||||
const { id, provider, displayName } = profile;
|
||||
|
||||
user = await UsersService.findOrCreateExternalUser(
|
||||
req.context,
|
||||
id,
|
||||
provider,
|
||||
displayName
|
||||
);
|
||||
} catch (err) {
|
||||
return done(err.toString());
|
||||
return done(err);
|
||||
}
|
||||
|
||||
return ValidateUserLogin(profile, user, done);
|
||||
|
||||
Reference in New Issue
Block a user