joelbutcher / socialstream

OAuth for Laravel, simplified.

Home Page:https://docs.socialstream.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[bug] Problems installing

nathcast opened this issue · comments

Describe the bug

Hi,
on installing the project, i get the error report:

Class App\Actions\Socialstream\CreateUserFromProvider located in D:/laravel2023/eRAbones-2023-10-16/app\Actions\Socialstream\CreateUserWithTeamsFromProvider.php does not comply with psr-4 autoloading standard. Skipping.

highlighted in green
.
To be fair, it might not have any consequences/

To Reproduce

Steps to reproduce the behavior:
laravel new projectSocialStream
cd projectSocialStream
code .
composer require livewire/livewire
php artisan livewire:publish --config
composer require joelbutcher/socialstream
composer require laravel/jetstream
php artisan socialstream:install jetstream livewire
composer require filament/filament:"^3.0-stable" -W

Environment context

  • Socialstream version: 5.+
  • Jetstream stack: Livewire
  • Laravel version: 10.10
  • PHP version: 8.1.12 (cli)
    "require": {
    "php": "^8.1",
    "filament/filament": "3.0-stable",
    "guzzlehttp/guzzle": "^7.2",
    "joelbutcher/socialstream": "^5.0",
    "laravel/framework": "^10.10",
    "laravel/jetstream": "^4.0",
    "laravel/sanctum": "^3.2",
    "laravel/tinker": "^2.8",
    "livewire/livewire": "^3.0"
    },

I hope that this is helpful.

Nathalie

Thanks! I'll look into this today

Hi:
I have redone it, doing this

composer create-project laravel/laravel eRAbones-2023-10-26-03
cd eRAbones-2023-10-26-03
code .
composer require joelbutcher/socialstream
composer require laravel/jetstream
php artisan socialstream:install jetstream livewire
/// don't forget to update the .env file
php artisan migrate
nom run dev
php artisan serve

add

# file: config\services.php
    'github' => [

        'client_id' => env('GITHUB_CLIENT_ID'),

        'client_secret' => env('GITHUB_CLIENT_SECRET'),

        'redirect' => env('GITHUB_REDIRECT_URI')

    ],

    'google' => [

        'client_id' => env('GOOGLE_CLIENT_ID'),

        'client_secret' => env('GOOGLE_CLIENT_SECRET'),

        'redirect' => env('GITHUB_REDIRECT_URI')

    ],
   

and this time, it works. including the profile photo.

But then I run

php artisan socialstream:install filament 

and the profile photo disappears and not able to update it.

Call to undefined method App\Models\User::updateProfilePhoto()
and problem in APp\actions\Fortify\UpdateUserProfileInformation.php

I tried to use dd($input) and saw
"email" => "redacted"
"id" => 1
"name" => "redactedc"
"email_verified_at" => "2023-10-26T14:24:39.697000Z"
"current_team_id" => null
"profile_photo_path" => "profile-photos/nU7NjA3gMZqriB9U2gamzTM6lmBfZeOXJ8l9cLI5.jpg"
"created_at" => "2023-10-26T14:24:39.693000Z"
"updated_at" => "2023-10-26T14:25:27.423000Z"
"two_factor_secret" => null
"two_factor_recovery_codes" => null
"two_factor_confirmed_at" => null
]
so it looks like the variable name is profile_photo_path not photo

But when I change that, the photo is still not updating

My knowledge of all that is limited.
I will try to install filament another way.

Thanks for looking into this/

Nathalie

@nathcast are you trying to use the same user model for Jetstream AND Filament?

I am just trying to install filament as described in your doc and I cant make it work.

Just trying to have a base app that has jetstream, with socialite, then have filament on top of that to start designing tables using filament tables and forms, and all their widgets. I had a nice system that worked a in filament 2, but I am struggling with the new versions.

I would expect to use the same user model for the app and the admin panel. I never thought of having two Users models.

Is there anything in my workflow that is wrong?

Thanks for sugestions -

Also, another note: I have saved the working app in a git repo - if I clone that and then run composer install, I then come accross the first error message that we have a the top of this issue - I am not sure that it is a big deal, because it is in green.

anyway, thanks for your prompt replies so far. I didnt expect that you would be answering me so quickly, so thank you so much.

Nathalie

@nathcast I've managed to get this working with Socialstream working for both, I've pushed up a branch fix/filament-with which is designed to allow devs to use Socialstream with Filament as well as Jetstream or Breeze.

My suggested order to get up and running is:

  1. Create project
  2. composer require all required deps (make sure to target the dev branch above for Socialstream, you may need to update your composer.json's minimum-stability property to dev)
  3. Install Filament
  4. Install Jetstream (make a note of the optional features you are using)
  5. Install socialstream for filament: php artisan socialstream:install filament
  6. Install socialstream for jetstream: php artisan socialstream:install jetstream livewire <jetstream features from step 4>

It's really important that you install for Filament first THEN install for Jetstream as both commands will overwrite the user model (which you will want to retain the Jetstream one to keep the functionality for your users).

I'll look into how to get the profile avatar showing for Filament later

PS. I will write a guide for this in the documentation once I've finalised the support for this.

Dear Joel,
Thank you so much for your direction: I have followed your recipe and it works.

Here is what I have done - you may use that for your documentation if you find this useful.
(btw, I couldnt find on your site or on your github, a convenient way to copy paste composer require joelbutcher/socialstream : I would find it convenient to have is handy:)

composer create-project laravel/laravel projectName
cd projectName
composer require joelbutcher/socialstream
composer require filament/filament:"^3.0-stable" -W
composer require laravel/jetstream
composer require laravel/livewire 
php artisan filament:install --panels
 What is the ID? [admin]
❯ admin

   INFO  Filament panel [D:\laravel2023\eRAbones-2023-10-27-01\app\Providers/Filament/AdminPanelProvider.php] created successfully.

   WARN  We've attempted to register the AdminPanelProvider in your [config/app.php] file as a service provider. If you get an error while trying to access your panel then this process has probably failed. You can manually register the service provider by adding it to the [providers] array.
php artisan jetstream:install livewire
php artisan socialstream:install filament
php artisan socialstream:install jetstream livewire
code .

Next: in Code:

  • update .env
  • update config/database.php
  • update config/socialstream.php
  • update config/jetstream
/**
* @filename socialstream.php
* 
* */

return [

    'middleware' => ['web'],

    'prompt' => 'Or Login Via',

    'providers' => [

        Providers::github(),

        Providers::google(),

    ],

    'features' => [

        Features::createAccountOnFirstLogin(),

        // Features::generateMissingEmails(),

        Features::rememberSession(),

        Features::providerAvatars(),

        Features::refreshOAuthTokens(),

    ], 
  • update config/services
/*
| @filename config/services.php
*/

'github' => [

        'client_id' => env('GITHUB_CLIENT_ID'),

        'client_secret' => env('GITHUB_CLIENT_SECRET'),

        'redirect' => env('GITHUB_REDIRECT_URI')

    ],

    'google' => [

        'client_id' => env('GOOGLE_CLIENT_ID'),

        'client_secret' => env('GOOGLE_CLIENT_SECRET'),

        'redirect' => env('GOOGLE_REDIRECT_URI')

    ],

In this project:

php artisan migrate

If using photos, first register a user with a normal form and add a photo, then try the GIT and google.

It works:)

I am very happy:)

@nathcast thank you for the feedback, I'm glad I've been able to help. For reference, I've added the guide here