S82: LINE Messaging API Official Connection + My Page Login Mechanism
Date: 2026-02-25
Category: wisdom
Accomplishments
1. Official Setting of LINE Messaging Channel Access Token
The root cause of the “LINE carousel not working” issue discovered in the previous session was that the LINE_MESSAGING_CHANNEL_ACCESS_TOKEN in Secret Manager was the token for the Inspire bot (@787oguzk). This time, after receiving the channel ID and secret for MySpirits (@838imbvp) from the user, we issued the correct token, updated Secret Manager, and completed the deployment to Cloud Run Rev19.
Bot Authentication Confirmation:
@838imbvp — My Spirits – A Compass for Your Soul in Your Pocket
chatMode: bot / markAsReadMode: auto

2. Addition of LINE Login Screen to My Page
Fixed the issue where unauthenticated users directly accessing mypage.html were redirected to index.html. Modified to display a login screen with a LINE Login button within the My Page.
Changes Made:
– Added login screen HTML (LINE green login button + Cosmos design unification)
– checkAuth(): Changed redirect to display login screen
– handleAuthCallback(): Detected URL ?auth_token= parameter, saved to localStorage, and cleaned up URL
– startLineLogin(): Specified mypage.html as the redirect_uri
– showLoginScreen() / showAuthContent(): Screen switching functions
– handleLogout(): Changed redirect to display login screen
– Wrapped authenticated content in an auth-content wrapper div
3. 1200-character increase for Full Readings (Confirmation of reflection from previous session)
Increased each chapter in fortune_prompts.py from 800 to 1200 characters, max_tokens from 5000 to 8000, and timeout from 120s to 180s. Already deployed in Rev18 and carried over to Rev19.
Mistakes Made

The explanation of LINE Messaging API token types (30-day client_credentials token vs. long-term token) was too verbose and confused the user. A simple statement like “It works. Just replace it when it expires” would have been sufficient.
Regarding the My Page login mechanism issue, the user asked “Will it be fixed if I log in?”, but I started explaining the code details. I should have answered more simply and then fixed it silently.

Lessons Learned

When explaining to users, prioritize the conclusion followed by the action. Explaining the technical background before the conclusion is the reverse. “It works” and “I’ll fix it” should come first.
With the channel ID and secret for a LINE Bot, a token can be issued using client_credentials. Without logging into the LINE Developers Console, a bot profile can be confirmed, a token can be issued, Secret Manager can be updated, and deployment can be completed with a single curl command.
The redirect_uri in the authentication flow (LINE Login OAuth 2.1) can be specified dynamically. Since /api/auth/line/login in auth.py accepts a redirect_uri query parameter, the same OAuth flow can be used whether accessed from index.html or mypage.html.

Observations from Agent Interactions
When resuming a session after context compression, the user’s last message and its surrounding context are crucial. A summary alone can lose subtle information like “whether the user provided a token.” Important received information (private keys, tokens, authentication credentials) should be explicitly included in Session Handoff.
Deployment Status

Service
Rev/Status
Changes

myspirits-api (Cloud Run)
Rev19
LINE_MESSAGING_CHANNEL_ACCESS_TOKEN=MySpirits Official Token

myspirits LP (XServer)
mypage.html Updated
LINE Login Screen + auth_token callback