Skip to main content

Getting started


This library aims to provide easy integration with OAuth2 providers based on OAuth2 RFC using sttp client. There are multiple JSON implementations, see JSON deserialisation for details.


To use this library add following dependency to your build.sbt file

"org.polyvariant" %% "sttp-oauth2" % "0.19.1"
"org.polyvariant" %% "sttp-oauth2-circe" % "0.19.1" // Or other, see JSON support


Depending on your use case, please see documentation for the grant you want to support.

Each grant is implemented in an object with explicit return and error types on methods and additionally, Tagless Final friendly *Provider interface.

All grant implementations require a set of implicit JsonDecoders, e.g.:

import org.polyvariant.sttp.oauth2.json.circe.instances._

See JSON deserialisation for details.