joselfonseca / lighthouse-graphql-passport-auth

Add GraphQL mutations to get tokens from passport for https://lighthouse-php.com/
https://lighthouse-php-auth.com/
MIT License
231 stars 55 forks source link

Using multiple Clients #112

Closed th3error closed 4 years ago

th3error commented 4 years ago

Hi,

Is there a way to use multiple passport clients which are associated with multiple providers/guards? I'm trying to implement Multi-Auth where I have multiple tables to authenticate from. Each table is linked to a different user model.

I have everything setup except allowing for multiple 'client_id' and 'client_secret' (lighthouse-graphql-passport.php)

This comment here makes me believe there is no native suppot for the above: https://github.com/joselfonseca/lighthouse-graphql-passport-auth/issues/65#issuecomment-587446888

Any idea what files I need to hack in order to achieve this?

joselfonseca commented 4 years ago

If I am not mistaken, you can modify the GraphQL schema to receive the client_id and client_secret in the mutation and it will use it. Regarding the multiple models you will have to set that up in runtime from a request parameter.

joselfonseca commented 4 years ago

image

Yes you can send that in the mutation, that is the line. Sorry for the screenshot I am mobile right now. All you have to do is update the GraphQL schema to accept the additional parameters.