Auto register for custom social login provider #2708

Closed
opened 2026-02-05 04:52:32 +03:00 by OVERLORD · 3 comments
Owner

Originally created by @androbey on GitHub (Mar 15, 2022).

Attempted Debugging

  • I have read the debugging page

Searched GitHub Issues

  • I have searched GitHub for the issue.

Describe the Scenario

I did setup a custom SocialLogin Provider using the Logical Theme System. This works as expected with existing users.

Now, I want to enable "auto register" for this provider (just like e.g. TWITCH_AUTO_REGISTER=true in .env file).
Is there any way to add some configuration to enable auto register for custom providers, without editing source files?

Exact BookStack Version

v22.02.3

Log Content

No response

PHP Version

8.0

Hosting Environment

Ubuntu 20.04 VPS

Originally created by @androbey on GitHub (Mar 15, 2022). ### Attempted Debugging - [X] I have read the debugging page ### Searched GitHub Issues - [X] I have searched GitHub for the issue. ### Describe the Scenario I did setup a custom SocialLogin Provider using the Logical Theme System. This works as expected with existing users. Now, I want to enable "auto register" for this provider (just like e.g. `TWITCH_AUTO_REGISTER=true` in .env file). Is there any way to add some configuration to enable auto register for custom providers, without editing source files? ### Exact BookStack Version v22.02.3 ### Log Content _No response_ ### PHP Version 8.0 ### Hosting Environment Ubuntu 20.04 VPS
OVERLORD added the 🐕 Support label 2026-02-05 04:52:32 +03:00
Author
Owner

@ssddanbrown commented on GitHub (Mar 21, 2022):

Hi @androbey,
Sorry for the late response.

Looking at the codebase, you should be able to just add those options to the config array when using the theme system like so:

Theme::addSocialDriver('reddit', [
    'client_id' => 'abc123',
    'client_secret' => 'def456789',
    'name' => 'Reddit',
    'auto_register' => true,
    'auto_confirm' => true,
], '\SocialiteProviders\Reddit\RedditExtendSocialite@handle');

Let me know how that goes and, if that doesn't work, I'll dig a bit deeper and do some testing.

@ssddanbrown commented on GitHub (Mar 21, 2022): Hi @androbey, Sorry for the late response. Looking at the codebase, you should be able to just add those options to the config array when using the theme system like so: ```php Theme::addSocialDriver('reddit', [ 'client_id' => 'abc123', 'client_secret' => 'def456789', 'name' => 'Reddit', 'auto_register' => true, 'auto_confirm' => true, ], '\SocialiteProviders\Reddit\RedditExtendSocialite@handle'); ``` Let me know how that goes and, if that doesn't work, I'll dig a bit deeper and do some testing.
Author
Owner

@androbey commented on GitHub (Mar 21, 2022):

Hi @ssddanbrown,

sorry, you're right. I missed that the entire config array is passed (and obviously didn't read the comment clearly enough) (ee6a2339b6/app/Auth/Access/SocialAuthService.php (L307)).

So, in fact, does work fine this way. Thank you very much and sorry to bother!

@androbey commented on GitHub (Mar 21, 2022): Hi @ssddanbrown, sorry, you're right. I missed that the entire config array is passed (and obviously didn't read the comment clearly enough) (https://github.com/BookStackApp/BookStack/blob/ee6a2339b654d1a4537319fb1548fd311549dfc7/app/Auth/Access/SocialAuthService.php#L307). So, in fact, does work fine this way. Thank you very much and sorry to bother!
Author
Owner

@ssddanbrown commented on GitHub (Mar 21, 2022):

No bother at all! Happy to hear it works!

@ssddanbrown commented on GitHub (Mar 21, 2022): No bother at all! Happy to hear it works!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#2708