PacktPublishing / Vue-js-2-Web-Development-Projects

Vue js 2 Web Development Projects, published by Packt
MIT License
222 stars 144 forks source link

Project 4. Google+ API doesn't work anymore #7

Open nkoval opened 4 years ago

nkoval commented 4 years ago

When I try to login using google, I am getting the following response

GooglePlusAPIError: Legacy People API has not been used in project before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/legacypeople.googleapis.com/overview?project= then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.

It seems that Google+ API has been shot down

kpoxo6op commented 4 years ago

@nkoval I have very limited node.js knowledge but I managed to fix it.

What you need to do is to update your passportjs and import the new version in your auth.js file:

  1. npm install passport-google-oauth20@2 --save
  2. at your server file Chapter06/chapter6-full/server/src/auth.js replace this: import { OAuth2Strategy as GoogleStrategy } from 'passport-google-oauth' with this: var GoogleStrategy = require('passport-google-oauth20');

your auth.js file should look like this now:

import passport from 'passport'
//import { OAuth2Strategy as GoogleStrategy } from 'passport-google-oauth'
var GoogleStrategy = require('passport-google-oauth20');
import * as Users from './connectors/users'
import { GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET, PUBLIC_URL } from './config'
passport.use(new GoogleStrategy(
...

source: https://medium.com/passportjs/google-api-shutdown-330c3b47e3df

SXiaoL commented 4 years ago

Error: read ECONNRESET at Strategy.OAuth2Strategy._createOAuthError (F:\workspace\server\node_modules\passport-oauth2\lib\strategy.js:408:17) at F:\workspace\server\node_modules\passport-oauth2\lib\strategy.js:175:45 at F:\workspace\server\node_modules\oauth\lib\oauth2.js:193:7 at ClientRequest. (F:\workspace\server\node_modules\oauth\lib\oauth2.js:162:5) at ClientRequest.emit (events.js:315:20) at ClientRequest.EventEmitter.emit (domain.js:486:12) at TLSSocket.socketErrorListener (_http_client.js:469:9) at TLSSocket.emit (events.js:315:20) at TLSSocket.EventEmitter.emit (domain.js:486:12) at emitErrorNT (internal/streams/destroy.js:106:8)

I have encountered the above problems. How can I solve them

mingluosunyi commented 2 years ago

Error: read ECONNRESET at Strategy.OAuth2Strategy._createOAuthError (F:\workspace\server\node_modules\passport-oauth2\lib\strategy.js:408:17) at F:\workspace\server\node_modules\passport-oauth2\lib\strategy.js:175:45 at F:\workspace\server\node_modules\oauth\lib\oauth2.js:193:7 at ClientRequest. (F:\workspace\server\node_modules\oauth\lib\oauth2.js:162:5) at ClientRequest.emit (events.js:315:20) at ClientRequest.EventEmitter.emit (domain.js:486:12) at TLSSocket.socketErrorListener (_http_client.js:469:9) at TLSSocket.emit (events.js:315:20) at TLSSocket.EventEmitter.emit (domain.js:486:12) at emitErrorNT (internal/streams/destroy.js:106:8)

I have encountered the above problems. How can I solve them

I meet this problem too, have you solved it ?