OAuth

Use the OAuth connection flow to connect an account to your platform.

Step 1: Create the OAuth link

https://auth.yorlet.com/oauth/authorize?
client_id={{YOUR_CLIENT_ID}}&response_type=code&scope=read_write

Send your users to this URL to start the connection flow.

Step 2: User creates or connects their account

After the user clicks the link on your site, they'll be taken to Yorlet's website where they'll be prompted to allow or deny the connection to your platform.

The user can either create an account or connect an existing account

Step 3: User is redirected back to your site

After the user connects their account to your platform, they will be redirected back to your site, to the redirect_uri you provided.

For successful connections, we’ll also send these parameters in the URL:

  • The scope granted.

  • The state value, if provided.

  • An authorization code.

https://example.com?scope=read_write&code={{AUTHORIZATION_CODE}}

Step 4: Complete connection

Connect the account to your platform by sending the authorization code in a POST request to Yorlet's API.

curl https://api.yorlet.com/v1/oauth/token \
-H "Authorization: Bearer {{API_KEY}}" \
-H "Content-Type: application/json" \
-d '{
"code": "{{AUTHORIZATION_CODE}}",
"grant_type": "authorization_code"
}'

We will return a response that includes the user's yorlet_account_id.

{
"scope": "read_write",
"yorlet_account_id": "{{ACCOUNT_ID}}",
}

Store the yorlet_account_id in your database. You’ll use this value to authenticate as the account by passing it into requests in the Yorlet-Account header.