Do you run a LINE Official Account and want to match quiz responses with the same people in your LINE friend data? OOOPEN Lab's Custom OAuth login can connect your own LINE Login Channel. After a player signs in and completes a quiz, the response webhook can carry the same LINE userId namespace used by the Messaging API channel connected to that official account.
This guide assumes you already understand the basic OAuth setup and OOOPEN Lab webhooks. It focuses on the LINE-specific requirements.
Contents
- Why the built-in LINE sign-in is not enough
- Step 1: configure a channel in LINE Developers
- Step 2: configure OOOPEN Lab
- Step 3: verify the LINE userId
- Step 4: inspect the webhook data
- End-to-end test
- Troubleshooting and FAQ
Why the built-in LINE sign-in is not enough
OOOPEN Lab offers two different LINE login paths. They do not produce interchangeable identifiers.
| Editor option | LINE channel being used | Identifier you receive |
|---|---|---|
| Built-in social sign-in with LINE enabled | OOOPEN Lab's shared LINE Login Channel | A valid LINE userId in OOOPEN Lab's channel namespace; it does not match your official account's friend ID |
| Custom OAuth login | A LINE Login Channel created under your own LINE Developers provider | The same userId namespace as the Messaging API channel under that provider |
If your CRM or marketing automation needs to identify “this respondent is this LINE friend,” use Custom OAuth and satisfy all of the following prerequisites:
- Your OOOPEN Lab account has access to Custom OAuth login. Availability depends on the current plan and add-ons.
- You own or can create a LINE Login Channel. This is not the same as a Messaging API Channel.
- Most importantly, the LINE Login Channel and the official account's Messaging API Channel belong to the same LINE Developers Provider. LINE user IDs are provider-scoped; IDs from different providers cannot be matched.
Step 1: configure a channel in LINE Developers
1.1 Create or select a LINE Login Channel
Open the LINE Developers Console. Select the provider that already contains the Messaging API channel for your LINE Official Account. Create a new channel and choose LINE Login, or reuse an existing LINE Login Channel under that same provider.
1.2 Copy the Channel ID and secret
In the channel's Basic settings, locate:
- Channel ID — not secret;
- Channel secret — confidential.
You will use both in the OOOPEN Lab editor. Store the secret only in approved systems and never paste it into a public issue, screenshot, or client-side page.
1.3 Register the callback URL
Under LINE Login → Callback URL, register the callback for each quiz:
https://ooopenlab.cc/auth/{QUIZ_ID}/callback
{QUIZ_ID} is the identifier in the quiz editor URL. The safest method is to open Logging Requirements Settings in the quiz editor and copy the actual redirect_uri shown beneath OAuth Login URL. Add that exact value to LINE Developers.
1.4 Optional: request email permission
LINE does not return an email address by default. If your integration genuinely requires it:
- Request Email address permission for the channel and wait for approval.
- Add
emailto the OAuth scope in step 2.2. - Explain why the email is collected and handle the absence of an email even after requesting it.
1.5 Publish the channel
Your own LINE account may be added as a tester while the integration is under development. Move the channel to Published before the real campaign begins.
Step 2: configure OOOPEN Lab
Open the quiz editor, go to Logging Requirements Settings, enable Custom OAuth login, and complete the following fields.
2.1 Display fields
| Field | Value | Example |
|---|---|---|
| Your Platform Name | Appears in the “Log in with XXX” button | LINE |
| Login Button Color | A valid HEX color | #06C755 |
2.2 OAuth Login URL
Use LINE's authorization endpoint with your Channel ID and required scopes. Do not add redirect_uri or state; OOOPEN Lab appends them automatically.
https://access.line.me/oauth2/v2.1/authorize?response_type=code&client_id={YOUR_CHANNEL_ID}&scope=profile%20openid
Optional changes:
- To request email after LINE approval, use
scope=profile%20openid%20email. - To prompt the player to add the official account, append
&bot_prompt=normal. This requires the Login Channel and official account's Messaging API Channel to be linked under the same provider.
2.3 Grant Type
Select Authorization Code (?code='{code}'). Do not use Implicit Flow for this LINE setup.
2.4 Token Exchange URL
Use LINE's token endpoint and insert your own Channel ID and secret:
https://api.line.me/oauth2/v2.1/token?grant_type=authorization_code&client_id={YOUR_CHANNEL_ID}&client_secret={YOUR_CHANNEL_SECRET}
The Channel secret is stored in this quiz's protected backend configuration so the server can exchange the authorization code. By entering it, you authorize OOOPEN Lab to hold that secret. If the channel is shared with other systems or your security requirements are stricter, create a dedicated LINE Login Channel for OOOPEN Lab under the same provider.
2.5 User Data Retrieval Method
Select OpenID Connect and enter this OpenID Connect (OIDC) URL:
https://api.line.me/oauth2/v2.1/verify?client_id={YOUR_CHANNEL_ID}
OOOPEN Lab sends the id_token to the verification endpoint and reads the verified payload:
sub→ LINE userId and member ID;name→ display name;email→ email, only when permission and scope are both present.
The OAuth scope must include openid; otherwise LINE does not return an id_token and login fails. Save the settings before testing.
Step 3: verify the LINE userId
With this configuration, the member ID shown in response management, CSV exports, and webhook data is the raw LINE userId, such as U1234567890abcdef.... It should exactly match the userId delivered by the Messaging API for the same friend, without adding or removing a prefix.
This match depends on the shared provider. If you change to a channel under another provider, a LINE user signing in again receives an ID from a different namespace and cannot be matched to the old record.
The built-in LINE social login may also display a value beginning with U, but it belongs to OOOPEN Lab's provider and therefore does not match your official account friend ID.
Step 4: inspect the webhook data
After a player completes the quiz, OOOPEN Lab sends the configured event to your webhook URL. When OAuth is enabled, the member data appears in data.oauthUser.
{
"type": "finish",
"timestamp": "2026-06-01T12:34:56.789Z",
"data": {
"answerId": "answer-123",
"quizId": "quiz-123",
"quizName": "Personality Type Quiz",
"startedAt": "2026-06-01T12:30:00.000Z",
"finishedAt": "2026-06-01T12:34:56.000Z",
"duration": 296000,
"result": {
"id": "result-a",
"label": "Analytical Explorer"
},
"oauthUser": {
"id": "U1234567890abcdef...",
"email": "[email protected]",
"provider": "custom"
},
"answers": [
{ "id": "q1", "title": "Question 1", "value": "Choice A", "duration": 1234 }
]
}
}
Use data.oauthUser.id as the LINE identifier:
const lineUserId = payload.data.oauthUser.id;
// Compare this exact value with your official-account friend records.
// It may also be used in an authorized Messaging API request such as
// GET /v2/bot/profile/{userId}.
Your webhook must authenticate requests according to your integration design, validate the payload, handle retries safely, and avoid logging secrets or unnecessary personal data.
End-to-end test
Run this test before publishing:
- Save the settings and open the quiz in a private window.
- Select Log in with {Your Platform Name}. The popup should navigate to
access.line.me. - Complete LINE sign-in. The popup should close and the original window should continue into the quiz.
- Complete the quiz and find the response in OOOPEN Lab response management. Confirm that the member ID is a LINE
U...value. - Confirm that your webhook server received the completion POST and that
data.oauthUser.idcontains the same value. - Compare it with the official account's Messaging API webhook log or an authorized
GET /v2/bot/profile/{userId}request. It should identify the same person. - Repeat a sign-in failure and webhook retry to verify that the integration fails safely and does not duplicate downstream work.
Troubleshooting and FAQ
The popup says that an error occurred during login
Inspect the browser console and the error returned to the original window.
| Error keyword | Likely cause | Fix |
|---|---|---|
invalid redirect_uri | The exact callback is not registered on the LINE Login Channel | Copy the redirect_uri shown under OAuth Login URL and add it to LINE Login → Callback URL |
invalid_client or invalid_request | Channel ID or secret is incorrect | Copy the values again from Basic settings |
state_not_found or invalid_state | Login state expired or required cookies were blocked | Retry promptly in a normal browser window and review browser privacy settings |
uerid_not_found | The verified token has no sub, commonly because openid is missing or the OIDC URL is wrong | Include openid and use the LINE verification URL shown above |
How do I receive email?
Request LINE's email permission and, after approval, use profile%20openid%20email as the scope. The integration must still handle an absent email.
Can one LINE Login Channel be used by several quizzes?
Yes. Register the callback URL of every quiz on the channel and configure the same Channel ID and secret separately in each quiz.
How do I join records across quizzes?
Use the same LINE Login Channel for every quiz. The same player then has the same data.oauthUser.id in those quiz webhooks. Your authorized backend can use that value as the cross-quiz key.
What happens if I replace the channel?
Update the Channel ID and secret in the OAuth Login URL, Token Exchange URL, and OIDC URL. Historical responses remain unchanged. Moving to a channel under another provider produces a different userId namespace, so new logins cannot be matched to old friend IDs.