Add manual Micropub token generation for non-PKCE clients
iA Writer's IndieAuth client predates PKCE support in the spec, so it can't complete the normal authorization flow. Add an admin form to mint a token directly (reusing the existing TokenService), so it can be pasted into clients that support manual token setup instead. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017USyUg8PwuoDcHP8pv5xjy
This commit is contained in:
parent
9e9fbdc127
commit
568ae78864
12 changed files with 190 additions and 2 deletions
|
|
@ -134,4 +134,30 @@
|
|||
.token-list button.revoke:hover {
|
||||
background: light-dark(oklch(80% 0.2 25deg), oklch(45% 0.18 25deg));
|
||||
}
|
||||
|
||||
.token-reveal {
|
||||
margin-block-end: 1em;
|
||||
padding: 1em 1.2em;
|
||||
border: 1px solid var(--clr-border);
|
||||
border-radius: 16px;
|
||||
background: light-dark(
|
||||
oklch(96% 0.08 145deg),
|
||||
oklch(28% 0.08 145deg)
|
||||
);
|
||||
|
||||
input {
|
||||
width: 100%;
|
||||
font-family: monospace;
|
||||
padding: 0.5em 0.7em;
|
||||
border-radius: 8px;
|
||||
border: 1px solid var(--clr-border);
|
||||
}
|
||||
}
|
||||
|
||||
.scope-checkboxes {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 1em;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
52
resources/views/admin/tokens/create.blade.php
Normal file
52
resources/views/admin/tokens/create.blade.php
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
@extends('master')
|
||||
|
||||
@section('title')New Token « Admin CP « @stop
|
||||
|
||||
@section('content')
|
||||
<h1>Generate a new token</h1>
|
||||
<p>Use this for clients that can't complete the IndieAuth authorization flow (e.g. they don't support PKCE) and instead let you paste in a token directly.</p>
|
||||
|
||||
<form action="/admin/tokens" method="post" accept-charset="utf-8" class="admin-form form">
|
||||
{{ csrf_field() }}
|
||||
|
||||
<div>
|
||||
<label for="client_id">Client</label>
|
||||
<input
|
||||
type="text"
|
||||
name="client_id"
|
||||
id="client_id"
|
||||
value="{{ old('client_id') }}"
|
||||
placeholder="https://ia.net/writer"
|
||||
required
|
||||
>
|
||||
</div>
|
||||
|
||||
<div class="scope-checkboxes">
|
||||
<span>Scope</span>
|
||||
<label for="scope_create">
|
||||
<input
|
||||
type="checkbox"
|
||||
name="scope[]"
|
||||
id="scope_create"
|
||||
value="create"
|
||||
@checked(in_array('create', old('scope', []), true))
|
||||
>
|
||||
create
|
||||
</label>
|
||||
<label for="scope_update">
|
||||
<input
|
||||
type="checkbox"
|
||||
name="scope[]"
|
||||
id="scope_update"
|
||||
value="update"
|
||||
@checked(in_array('update', old('scope', []), true))
|
||||
>
|
||||
update
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<button type="submit" name="save">Generate token</button>
|
||||
</div>
|
||||
</form>
|
||||
@stop
|
||||
|
|
@ -4,6 +4,15 @@
|
|||
|
||||
@section('content')
|
||||
<h1>Micropub Tokens</h1>
|
||||
<p><a href="/admin/tokens/create">Generate new token</a></p>
|
||||
|
||||
@if(session('new_token'))
|
||||
<div class="token-reveal">
|
||||
<p>Here's your new token. <strong>Copy it now</strong> — it won't be shown again.</p>
|
||||
<input type="text" readonly value="{{ session('new_token') }}" onclick="this.select()">
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if($tokens->isEmpty())
|
||||
<p>No tokens have been issued.</p>
|
||||
@else
|
||||
|
|
|
|||
Loading…
Reference in a new issue