Skip to content
This repository was archived by the owner on Nov 20, 2019. It is now read-only.

Sorry, something went wrong, please try again. #29

Open
keerthivasan-r opened this issue May 28, 2016 · 1 comment
Open

Sorry, something went wrong, please try again. #29

keerthivasan-r opened this issue May 28, 2016 · 1 comment

Comments

@keerthivasan-r
Copy link

keerthivasan-r commented May 28, 2016

Hi, I have integrated the plugin with our hapi server. Thanks for the plugin. When i click on Signin with Google buttton, it takes to the google page, when the user enters credentials and allow access to the application. Everything happens fine. But, the profile data is not being sent by google. Is there any settings that i miss?

if (profile) {
        debugger;
        // extract the relevant data from Profile to store in JWT object
        var session = {
            firstname: profile.name.givenName,
            image: profile.image.url,
            id: profile.id,
            exp: Math.floor(new Date().getTime() / 1000) + 7 * 24 * 60 * 60,
            agent: req.headers['user-agent']
        };
        // create a JWT to set as the cookie:
        var token = JWT.sign(session, process.env.JWT_SECRET);
        // store the Profile and Oauth tokens in the Redis DB using G+ id as key
        // Detailed Example...? https://github.com/dwyl/hapi-auth-google/issues/2
        console.log(profile);
        // reply to client with a view
        return reply("Hello " + profile.name.givenName + " You Logged in Using Goolge!")
            .state('token', token); // see: http://hapijs.com/tutorials/cookies
    }
    else {
        return reply("Sorry, something went wrong, please try again.");
    }

It always enter the else loop in the above code. I really appreciate your help

@nelsonic
Copy link
Member

@keerthivasan-r apologies for taking so long to get back to you. did you figure it out?
Once you have the Oauth2 Token are you requesting the person's profile info?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants