Download profile image on registration/login using OAuth2 / social logins #1939

Open
opened 2026-02-05 02:16:14 +03:00 by OVERLORD · 1 comment
Owner

Originally created by @nekromoff on GitHub (Nov 14, 2020).

Describe the feature you'd like
Currently a new user gets a random profile image instead of image being taken from the social login service. This should be easy to implement, basically a cosmetic change.

Describe the benefits this feature would bring to BookStack users
Smoother UX. Profile automatically built from existing info using social login.

Additional context
n/a

example code - tested with google login

// remote user
$user = Socialite::driver('google')->stateless()->redirectUrl(route('login.google.callback'))->with(['redirect_uri' => route('login.google.callback')])->user();
//generate image name
$whatever_image_name=trim(strtolower(str_replace(' ', '', iconv('UTF-8', 'ASCII//TRANSLIT', $user->getName())))); 
// avatar image, replacing smaller size for larger size
$avatar = str_replace('sz=50', 'sz=200', $user->getAvatar());
// save image
Storage::put('users/' . $whatever_image_name, file_get_contents($avatar));
// set profile image for a local user
$local_user->image =$whatever_image_name;
Originally created by @nekromoff on GitHub (Nov 14, 2020). **Describe the feature you'd like** Currently a new user gets a random profile image instead of image being taken from the social login service. This should be easy to implement, basically a cosmetic change. **Describe the benefits this feature would bring to BookStack users** Smoother UX. Profile automatically built from existing info using social login. **Additional context** n/a **example code - tested with google login** ``` // remote user $user = Socialite::driver('google')->stateless()->redirectUrl(route('login.google.callback'))->with(['redirect_uri' => route('login.google.callback')])->user(); //generate image name $whatever_image_name=trim(strtolower(str_replace(' ', '', iconv('UTF-8', 'ASCII//TRANSLIT', $user->getName())))); // avatar image, replacing smaller size for larger size $avatar = str_replace('sz=50', 'sz=200', $user->getAvatar()); // save image Storage::put('users/' . $whatever_image_name, file_get_contents($avatar)); // set profile image for a local user $local_user->image =$whatever_image_name; ```
OVERLORD added the 🔨 Feature Request🚪 Authentication🏭 Back-End labels 2026-02-05 02:16:14 +03:00
Author
Owner
@rubentalstra commented on GitHub (May 24, 2025): - ref: https://github.com/BookStackApp/BookStack/pull/5429 - ref: https://github.com/BookStackApp/BookStack/pull/5626
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#1939