PocketBase with LINE Login
To set up PocketBase to use LINE Login as an OAuth2 identity provider for authentication, first create a LINE Login channel in the LINE Developers Console.
- Note the Channel ID and Secret from the LINE Login channel settings.
- This will be the Client ID and Client Secret in PocketBase OAuth2 configuration.
- Set the Callback URL in LINE Developers Console to
https://yourdomain.com/api/oauth2-redirect- Replace
yourdomain.comwith your PocketBase domain.
- Replace
Update users collection fields
Remove email validation. Edit the
userscollection and remove the “non-empty” validation requirement from theemailfield. This allows users to sign up with LINE without providing an email address.Add
externalIdfield. Add a new text field to theuserscollection to store the LINE user ID.Create a unique index on
externalId. This is to ensure no two users can have the same LINE user ID.
Set up OAuth2 configuration
Again in users collection settings, go to the Options tab, and under Auth Methods, enable OAuth2 and configure the following:
Add the
oidcprovider. Configure the provider with these settings:Setting Value Auth URL https://access.line.me/oauth2/v2.1/authorizeToken URL https://api.line.me/oauth2/v2.1/tokenFetch user info from User info URL User info URL https://api.line.me/oauth2/v2.1/userinfoSupport PKCE ✓ (enabled) Set up field mapping. Expand Optional users create fields map section and map OAuth2 response fields to PocketBase user fields:
OAuth2 full name→nameOAuth2 avatar→avatarOAuth2 id→externalId