This repository has been archived by the owner. It is now read-only.
A very thin Clojure wrapper for the SPID Java SDK
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src/spid_client_clojure
.gitignore
README.md
project.clj

README.md

spid-client-clojure

A Clojure wrapper for the SPID Java client.

Install

Add [spid-client-clojure "1.0.0"] to :dependencies in your project.clj.

Usage

Start by creating a client:

(def client (create-client client-id secret))

You can also pass in an option map. These are the defaults:

{:spp-base-url "https://identity-pre.schibsted.com"
 :redirect-uri "http://localhost:8080"}

Note: The :redirect-uri really makes no sense in this context, but is required by the API. It only comes into play when logging in as a user.

Server to server communication

Using the client, create a server token:

(def token (create-server-token client))

Then call the API with:

(GET client token "/users")

It can also take an optional parameters map.

Calling API on behalf of users

Create a user token with:

(def token (create-user-token client code))

This is the code you get after a user has logged in on SPiD.

Otherwise it works just like the server-to-server API.

(GET client token "/me")