Integration Guide
Overview
This document outlines the steps required to integrate OAuth2 authentication for Lemonade services in your application. It includes acquiring necessary credentials, setting up endpoints, and handling authorization and token refresh flows.
Prerequisites
Obtain client_id
and client_secret
from Lemonade. Note that this process is currently managed internally and does not have a UI interface.
OAuth2 Endpoints
Lemonade OAuth2 utilizes the following endpoints:
Authorization:
https://oauth2.lemonade.social/oauth2/auth
Token:
https://oauth2.lemonade.social/oauth2/token
User Information:
https://oauth2.lemonade.social/userinfo
End Session:
https://oauth2.lemonade.social/oauth2/sessions/logout
Library Usage
We use oidc-client-ts
for handling the authorization flow and managing session/tokens.
Configuration
First, import and configure the UserManager
from oidc-client-ts
:
Authorization Flow
Initiate Login:
Perform a call to the authorization endpoint:
This will redirect to Lemonade Identity for user login and consent (currently auto-skipped). After login, it redirects to /oauth2/callback
.
Handle Callback:
Process the callback to obtain the user response:
response includes access tokens and refresh tokens, which should be stored within your application.
Making Requests:
Use the access token to make requests to the Lemonade backend: https://backend.lemonade.social/graphql
Put the access token in the
x-ory-kratos-session
header
Token Refresh Flow
Access tokens are valid for 1 hour. To refresh:
Log Out Flow
To perform a logout:
Last updated