curl --request POST \
--url https://mylifenote.ai/api/agent/v1/oauth/token \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data grant_type=authorization_code \
--data code=lnoc_EXAMPLEcodeNotReal \
--data 'redirect_uri=<string>' \
--data code_verifier=dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXkimport requests
url = "https://mylifenote.ai/api/agent/v1/oauth/token"
payload = {
"grant_type": "authorization_code",
"code": "lnoc_EXAMPLEcodeNotReal",
"redirect_uri": "<string>",
"code_verifier": "dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk"
}
headers = {"Content-Type": "application/x-www-form-urlencoded"}
response = requests.post(url, data=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
body: new URLSearchParams({
grant_type: 'authorization_code',
code: 'lnoc_EXAMPLEcodeNotReal',
redirect_uri: '<string>',
code_verifier: 'dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk'
})
};
fetch('https://mylifenote.ai/api/agent/v1/oauth/token', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://mylifenote.ai/api/agent/v1/oauth/token",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "grant_type=authorization_code&code=lnoc_EXAMPLEcodeNotReal&redirect_uri=%3Cstring%3E&code_verifier=dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk",
CURLOPT_HTTPHEADER => [
"Content-Type: application/x-www-form-urlencoded"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://mylifenote.ai/api/agent/v1/oauth/token"
payload := strings.NewReader("grant_type=authorization_code&code=lnoc_EXAMPLEcodeNotReal&redirect_uri=%3Cstring%3E&code_verifier=dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://mylifenote.ai/api/agent/v1/oauth/token")
.header("Content-Type", "application/x-www-form-urlencoded")
.body("grant_type=authorization_code&code=lnoc_EXAMPLEcodeNotReal&redirect_uri=%3Cstring%3E&code_verifier=dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk")
.asString();require 'uri'
require 'net/http'
url = URI("https://mylifenote.ai/api/agent/v1/oauth/token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/x-www-form-urlencoded'
request.body = "grant_type=authorization_code&code=lnoc_EXAMPLEcodeNotReal&redirect_uri=%3Cstring%3E&code_verifier=dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk"
response = http.request(request)
puts response.read_body{
"access_token": "lna_EXAMPLEaccessTokenNotReal0000000000000000",
"refresh_token": "lnr_EXAMPLErefreshTokenNotReal000000000000000",
"token_type": "Bearer",
"expires_in": 3600,
"refresh_expires_in": 2592000,
"scope": "journal:read"
}Exchange a code or refresh a token
Public-client token endpoint (no client secret; token_endpoint_auth_methods_supported is none). Accepts application/x-www-form-urlencoded (RFC 6749) or application/json. Access tokens (lna_...) live 1 hour; refresh tokens (lnr_...) live 30 days. Refresh tokens rotate: every refresh returns a new refresh token and the previous one stops working. Presenting an already-rotated refresh token revokes the whole token family, so always store the newest refresh token. The client_id is not required or checked at this endpoint. This endpoint is not covered by the per-token rate limits.
curl --request POST \
--url https://mylifenote.ai/api/agent/v1/oauth/token \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data grant_type=authorization_code \
--data code=lnoc_EXAMPLEcodeNotReal \
--data 'redirect_uri=<string>' \
--data code_verifier=dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXkimport requests
url = "https://mylifenote.ai/api/agent/v1/oauth/token"
payload = {
"grant_type": "authorization_code",
"code": "lnoc_EXAMPLEcodeNotReal",
"redirect_uri": "<string>",
"code_verifier": "dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk"
}
headers = {"Content-Type": "application/x-www-form-urlencoded"}
response = requests.post(url, data=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
body: new URLSearchParams({
grant_type: 'authorization_code',
code: 'lnoc_EXAMPLEcodeNotReal',
redirect_uri: '<string>',
code_verifier: 'dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk'
})
};
fetch('https://mylifenote.ai/api/agent/v1/oauth/token', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://mylifenote.ai/api/agent/v1/oauth/token",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "grant_type=authorization_code&code=lnoc_EXAMPLEcodeNotReal&redirect_uri=%3Cstring%3E&code_verifier=dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk",
CURLOPT_HTTPHEADER => [
"Content-Type: application/x-www-form-urlencoded"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://mylifenote.ai/api/agent/v1/oauth/token"
payload := strings.NewReader("grant_type=authorization_code&code=lnoc_EXAMPLEcodeNotReal&redirect_uri=%3Cstring%3E&code_verifier=dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://mylifenote.ai/api/agent/v1/oauth/token")
.header("Content-Type", "application/x-www-form-urlencoded")
.body("grant_type=authorization_code&code=lnoc_EXAMPLEcodeNotReal&redirect_uri=%3Cstring%3E&code_verifier=dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk")
.asString();require 'uri'
require 'net/http'
url = URI("https://mylifenote.ai/api/agent/v1/oauth/token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/x-www-form-urlencoded'
request.body = "grant_type=authorization_code&code=lnoc_EXAMPLEcodeNotReal&redirect_uri=%3Cstring%3E&code_verifier=dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk"
response = http.request(request)
puts response.read_body{
"access_token": "lna_EXAMPLEaccessTokenNotReal0000000000000000",
"refresh_token": "lnr_EXAMPLErefreshTokenNotReal000000000000000",
"token_type": "Bearer",
"expires_in": 3600,
"refresh_expires_in": 2592000,
"scope": "journal:read"
}Body
- Authorization code grant
- Refresh grant
authorization_code Code from the redirect. Valid 5 minutes, single use.
"lnoc_EXAMPLEcodeNotReal"
Must exactly equal the redirect_uri used in the authorize step.
The PKCE verifier whose S256 hash was sent as code_challenge.
"dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk"
Response
Token pair.
Prefix lna_.
Prefix lnr_. Replaces the previous refresh token.
Bearer Access token lifetime in seconds (3600).
3600
Refresh token lifetime in seconds (2592000 = 30 days).
2592000
Space-separated granted scopes.
"journal:read"
Was this page helpful?

