3
votes

After calling $auth.loginWith('google'), I am getting http://localhost:3000/ru/user-registration#state=D7xooLsNNxNGfbvcQMU5g&access_token=ya29.a0Ae4lvC2z0XERgeRUipmu7c205WWCCSVgRZ-s_mYWg6ZoMgCGzVZ-U69arfpn-ybm5kthqtvqQrD7lGYmNDqiLtkW1aIecP6Wp-bwINMok3ztNcW5KwmlohLmtnbk4IZVkciKfb8T_JUtf89xpJcjpt2dSx_09FPGSKc&token_type=Bearer&expires_in=3599&scope=email%20profile%20openid%20https://www.googleapis.com/auth/userinfo.email%20https://www.googleapis.com/auth/userinfo.profile&authuser=0&prompt=consent as a callback. What should I do next in order to get the info of the registered gmail. Any help or ideas are welcome

auth part in my nuxt.config.js

auth: {
strategies: {
  local: {
    endpoints: {
      login: { url: "token/", method: "post", propertyName: "access" },
      user: { url: "user/me/", method: "get", propertyName: false },
      logout: false,
    }
  },
  google: {
    client_id: 'my_client_id',
    redirect_uri: 'http://localhost:3000',
  }
},

},

1
Could you share your nuxt.config.js file?Sébastien Serre
Hi. I have attached it in my question.izzatullokanoatov

1 Answers

0
votes

In your nuxt.config.js file you declare two differents strategies: local and google. If you would like to use Google as an identity provider you don't need to precise the endpoints.

Here is my actual config for one of my project:

auth: {
  redirect: {
    login: '/login',
    logout: '/login',
    home: '/',
    callback: '/callback'
  },
  strategies: {
    google: {
      client_id: 'XXXXXxxxx.apps.googleusercontent.com'
    }
  }
}

And I have specified on Google API Console the following authorized URI: localhost:3000/callback for my dev environment and mydomain.com/callback for the prod.