2021-08-06 17:31:02 +02:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
const GoogleStrategy = require('passport-google-oauth2');
|
|
|
|
|
2020-04-03 22:31:20 +02:00
|
|
|
module.exports = ({ env }) => ({
|
2020-04-29 16:22:22 +02:00
|
|
|
host: env('HOST', '0.0.0.0'),
|
|
|
|
port: env.int('PORT', 1337),
|
2020-05-11 17:09:48 +02:00
|
|
|
admin: {
|
2021-08-03 09:12:58 +02:00
|
|
|
// autoOpen: true,
|
2020-05-13 11:46:52 +02:00
|
|
|
auth: {
|
2020-05-12 14:57:24 +02:00
|
|
|
secret: env('ADMIN_JWT_SECRET', 'example-token'),
|
2021-08-06 17:31:02 +02:00
|
|
|
providers: [
|
|
|
|
{
|
|
|
|
uid: 'google',
|
|
|
|
displayName: 'Google',
|
|
|
|
icon: 'https://cdn2.iconfinder.com/data/icons/social-icons-33/128/Google-512.png',
|
|
|
|
createStrategy: strapi =>
|
|
|
|
new GoogleStrategy(
|
|
|
|
{
|
|
|
|
clientID: env('GOOGLE_CLIENT_ID'),
|
|
|
|
clientSecret: env('GOOGLE_CLIENT_SECRET'),
|
|
|
|
scope: [
|
|
|
|
'https://www.googleapis.com/auth/userinfo.email',
|
|
|
|
'https://www.googleapis.com/auth/userinfo.profile',
|
|
|
|
],
|
|
|
|
callbackURL: strapi.admin.services.passport.getStrategyCallbackURL('google'),
|
|
|
|
},
|
|
|
|
(request, accessToken, refreshToken, profile, done) => {
|
|
|
|
done(null, {
|
|
|
|
email: profile.email,
|
|
|
|
firstname: profile.given_name,
|
|
|
|
lastname: profile.family_name,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
),
|
|
|
|
},
|
|
|
|
],
|
2020-05-11 17:09:48 +02:00
|
|
|
},
|
|
|
|
},
|
2020-04-03 22:31:20 +02:00
|
|
|
});
|