Linkedin sign-in functionality using Clojure

Table of contents
Reading Time: 2 minutes

This blog will show you how to add Linkedin sign in functionality in your clojure web application.

First Create an application on Linkedin by following the link

https://developer.linkedin.com/documents/quick-start-guide Fill all the information and provide the Redirect URI which you use in your application .Once you create the application you will get the API Key and Secret Key.

Let’s reference the [noir.response :as resp] [cheshire.core :as parse] [clj-http.client :as client][noir.session :as session] in your app.routes.linkedin.clj namespace

In app.routes.linkedin.clj define an atom linkedin-atom to store the information

Now define the routes :-
The GET linked-routes route simply call the linkedin function

Now we are going to use the authorization code to get the access token which gives us access to the user information through the REST API. In order to get the access token, we need to issue a POST request like the one below:

After a linkedin user grant access to the app, we’ll get a response containing access token on the redirection URI we provided while setting up our Linkedin app we’ll use “compojure.core’s” GET to get the response:

As we can see in the linkedin-login, if there is an authorization token, we proceed by getting the access_token, and finally make a formal request to LinkedIn.

1 thought on “Linkedin sign-in functionality using Clojure2 min read

Comments are closed.

Discover more from Knoldus Blogs

Subscribe now to keep reading and get access to the full archive.

Continue reading