Laragear / WebAuthn

Authenticate users with Passkeys: fingerprints, patterns and biometric data.
MIT License
308 stars 37 forks source link

Using different connection #5

Closed toystorynova closed 2 years ago

toystorynova commented 2 years ago

PHP & Platform

8.1.5

Laravel version

9.16.0

Authenticator type

No response

OS and Browser versions

No response

Have you done this?

Expectation

For my main site, I have a default database connection that goes to "DifferentSchema". For my auth, I have another database connection that goes to "AuthSchema"

I can't seem to figure out how to make webauthn use my "AuthSchema" connection. I added the "AuthSchema" database connection in App\User::class, and that fixed one of the errors, but there's more further down the "webauthn process" that I'm not sure how to fix.

Is there a way to specify what connection WebAuthn uses?

Thanks

Description

https://pastebin.com/raw/yrbc05V3 - Shows the default database connection being used and not the "AuthSchema" database connection I set in App\User::class

Reproduction

N/A

Stack trace & logs

https://pastebin.com/raw/yrbc05V3

Attestation / Assertion objects

No response

Are you a Patreon supporter?

No, don't give priority to this

DarkGhostHunter commented 2 years ago

You can change the connection of the relationship by overriding the trait that returns it.

I figured it out. Using a different DB connection is not supported, has it needs to be constant on both the user and without it.

May be in a next minor version, as it will have to work with different users and different connections.