joelbutcher / socialstream

OAuth for Laravel, simplified.

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Role via social

majweb opened this issue · comments

how to enter user role when running or registering via social. I read that using sessions but in which method does it help? Please not close.

Environment context

  • Socialstream version: latest
  • Jetstream stack: Inertia
  • Laravel version: 10
  • PHP version: 8

I'm not sure what you're trying to achieve, sorry. Do you want the roles from a provider stored in your database? If so then you'd need to update GenerateRedirectForProvider to request those scopes, then update CreateConnectedAccount to store them.

If you're referring to Jetstream roles, then you're best bet is to ask the wider Laravel community on their discord on how to achieve this on registration as this will be the same regardless of whether your users are using Social logins

I want to save user roles to the session, e.g. from input radio and after clicking login, e.g. via google, be able to use this session to assign this role to the user after logging in.

Socialstream for logging in e.g. via google uses the fortify controller? I don't think so. You don't have your controller for authorization?

I don't think what you're trying to achieve is possible. I would redirect all new registrations (regardless of whether they're using social login) to a route that asks them to choose their role, rather than having a radio button on the registration form.

The only way I can think of that achieves what you want, is to have an event listener on the radio button that does a form submit to the backend to store the users choice in the session (which will give your uses a terrible UX, because they'll have to wait for the form submission every time they change their mind)

Closing due to lack of activity