Using this IndieAuth endpoint
To use this authentication endpoint, add the following values to your website’s <head>
:
<link rel="authorization_endpoint" href="https://indiekit.ciccarello.me/auth">
<link rel="token_endpoint" href="https://indiekit.ciccarello.me/auth/token">
<link rel="indieauth-metadata" href="https://indiekit.ciccarello.me/.well-known/oauth-authorization-server">
Get a user’s identity
Request an authorization code
GET https://indiekit.ciccarello.me/auth
Content-type: application/x-www-form-urlencoded
response_type=code
&client_id=https://indiekit.ciccarello.me
&redirect_uri=https://indiekit.ciccarello.me/session/auth
&code_challenge=xxxxxxxxxx
&code_challenge_method=S256
&state=1234567890
&scope=create+delete+update
If the user approves the request, the endpoint will generate an authorization code and redirect back to the client:
HTTP/1.1 302 Found
Location: https://indiekit.ciccarello.me/session/auth?code=xxxxxxxx
&state=1234567890
&iss=https://indiekit.ciccarello.me
Redeem an authorization code for a user’s profile URL
POST https://indiekit.ciccarello.me/auth
Content-type: application/x-www-form-urlencoded
Accept: application/json
grant_type=authorization_code
&code=xxxxxxxxxx
&client_id=https://indiekit.ciccarello.me
&redirect_uri=https://indiekit.ciccarello.me/session/auth
&code_verifier=xxxxxxxxxx
HTTP/1.1 200 OK
Content-Type: application/json
{
"me": "https://www.ciccarello.me"
}
Get a user’s access permissions
Redeem an authorization code for an access token
POST https://indiekit.ciccarello.me/auth/token
Content-type: application/x-www-form-urlencoded
Accept: application/json
grant_type=authorization_code
&code=xxxxxxxxxx
&client_id=https://indiekit.ciccarello.me
&redirect_uri=https://indiekit.ciccarello.me/session/auth
&code_verifier=xxxxxxxxxx
HTTP/1.1 200 OK
Content-Type: application/json
{
"access_token": "xxxxxxxxxx",
"token_type": "Bearer",
"me": "https://www.ciccarello.me",
"scope": "create delete update"
}
Verify an access token
POST https://indiekit.ciccarello.me/auth/introspect
Content-type: application/x-www-form-urlencoded
Accept: application/json
Authorization: Bearer xxxxxxxx
token=xxxxxxxx
HTTP/1.1 200 OK
Content-Type: application/json
{
"active": true,
"client_id": "https://indiekit.ciccarello.me",
"me": "https://www.ciccarello.me",
"scope": "create delete update",
"iat": 1668682284,
"exp": 1676458284
}