Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Omniauth for Lift
Scala
branch: 2.4M5

This branch is 121 commits behind ghostm:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
demoproject
liftModuleJars
project/plugins
src
.gitignore
License.txt
README.markdown
build.sbt
build.xml

README.markdown

Lift-Omniauth Module

Usage

in Boot.scala

import omniauth.lib._
...
//Add Omniauth to the sitemap
Omniauth.sitemap
//init
//Supply a list of providers
Omniauth.initWithProviders(List(new FacebookProvider("key", "secret")))
//or init with providers in properties
OmniauthLib.init

in your properties file define your client id (key) and secret for each provider you will use

omniauth.facebooksecret=...
omniauth.facebookkey=...

For Facebook provider you can set permissions. For example:

omniauth.facebookpermissions=email,read_stream    

After a user has logged into an auth provider you can access data through the session var OmniauthLib.currentAuthMap

OmniauthLib.currentAuthMap match {
  case Full(omni) => ({
    println(omni.get(OmniauthLib.Provider))
    println(omni.get(OmniauthLib.UID))
    println(omni.get(OmniauthLib.UserInfo))
  })
}

You can also use obtain a user's unique ID from a provider without using sessions using Omniauth.tokenToId(provider:String, token:String): Box[String]

Omniauth.tokenToId("facebook", token) match {
  case Full(uid) => user.doSomethingWithFacebookId(uid)
}

Installation

A big thank you to jonoabroad for hosting builds to make using much easier.

libraryDependencies ++= Seq(
  "net.liftmodules" %% "omniauth" % "2.4-M5-0.5"
)

resolvers += "Omniauth repo" at "https://repository-liftmodules.forge.cloudbees.com/release"

Providers

Lift-OmniAuth currently supports the following external providers:

  • via OAuth
    • Facebook
    • Twitter
    • Github
Something went wrong with that request. Please try again.