{"repo":"jwojnowski/oidc4s","free":true,"listed":false,"github":"https://github.com/jwojnowski/oidc4s","clone":"git clone https://github.com/jwojnowski/oidc4s.git","description":"Purely functional Scala library for Open ID Connect 1.0 token verification and decoding","language":"Scala","stars":23,"topics":["oidc","scala","cats-effect","authentication","jwt","jwt-authentication","security","oauth2","open-id-connect"],"license":"MIT","category":"auth-billing-email","readme_excerpt":"oidc4s — Open ID Connect 1.0 token verification for Scala This library can be used to verify and decode ID Tokens from Open ID Connect 1.0 providers like Google, Microsoft, Apple, Auth0, Okta. Combined with OAuth 2.0 Authorization Code flow with PKCE on front-end side can lead to a simple, yet secure authentication for Single Page Applications. Scala versions 3.x and 2.13.x are supported. Getting started To use this library with default Sttp/Circe implementations, add the following dependency to your build.sbt : If you prefer zio-json over Circe, use oidc4s-quick-sttp4-zio-json instead. For Sttp3, use oidc4s-quick-sttp-circe or oidc4s-quick-sttp-zio-json . Creating IdTokenVerifier instance The next step depends on the runtime. Cats Effect For any effect with an existing implementation of Sync (e.g. Cats IO, ZIO, monix Task/IO), a version with cats.effect.Ref -based Cache can be used, for example: Id/Try/Either For entirely synchronous, impure usage, a combination of import me.wojnowski.oidc4s.impure.implicits. import and AtomicReference -based Cache instance can be used, for example: While the example shows Id implementation, Try and Either would be very similar, but different SttpBackend is needed. Verifying a token Token verification and decoding There are a few verification methods. Choosing one mostly comes down to which claims need to be decoded. Subject only ( verify ) To just verify a token is valid and matches the client ID use verify method. It returns Subject (usual","default_branch":null,"files":null,"tree":[],"storefront":"/r/jwojnowski","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/jwojnowski/oidc4s/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}