O'Reilly logo

Lift Application Development Cookbook by Gilberto T. Garcia Jr.

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Signing up using a Gmail account

In this section, we are going to learn how to log a user into your application using his or her Gmail account.

Getting ready

  1. Start a new blank project.
  2. Register your app.
  3. Edit the build.sbt file by adding the following dependencies:
       "net.databinder.dispatch" %% "dispatch-core" % "0.11.0"
    
  4. Add the values of client.id and client.secret in the default.props file.
    google.client.id=app-id
    google.client.secret=app=secret

How to do it...

Carry out the following steps to create a login mechanism using Gmail:

  1. Create a file called GoogleDispatcher.scala inside the code.lib package.
  2. Create a SessionVar object called googleSession:
    object googleSession extends SessionVar[Box[String]](Empty)
  3. Create a SessionVar object called googleAuthState ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required