Why Use OAuth

Delegating authentication to a third-party service has numerous benefits. It can make it easier for users to use your service because they can use their existing accounts. Conversely, it offloads user management to the third party, making your application simpler. Let’s take a look at what’s involved in allowing users to log in to the application using their existing Twitter accounts.

Create the Application

Let’s create a new Luminus project called oauth-example by running this:

 lein new luminus oauth-example

Next, let’s add the clj-oauth dependency in the project.clj file.

 :dependencies [...
  [clj-oauth ​"1.5.5"​]]

We’re ready to implement the Twitter Oauth workflow. Create a new namespace called oauth-example.twitter-oauth ...

Get Web Development with Clojure, 2nd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.