Tahul / nuxt-edgedb

💽 Nuxt 3 integration for EdgeDB
71 stars 7 forks source link

useNitroApp is not working #29

Closed ivanparramartinez closed 4 months ago

ivanparramartinez commented 5 months ago

I'm trying to make an oauth integration with github and I try to understand and reply your callback.ts file, but in the callback there is this code:

await useNitroApp().hooks.callHook(
    'edgedb:auth:callback' as any,
    {
      code,
      verifier,
      codeExchangeUrl,
      codeExchangeResponseData,
    },
  )

The issue is that it throws this error. There is no way to use it, and even after delete this line, the compiler or the nuxt cache will remain to show that error. Somehow, trying to implement the oauth have been a nightmare.

Captura de pantalla 2024-06-17 a la(s) 12 19 37 a  m

ivanparramartinez commented 5 months ago

The problem is directly with the nuxt-edgedb-module. I don't understand why the app relies on that folder that is predefined generated when installing the module. I need to look for another ways to make it work but I feel stuck. It does not consider the server/api/callback file that I have on Nuxt, it relies on that callback.mjs

Tahul commented 5 months ago

Hello @ivanparramartinez ;

Could you let me know if the ^0.0.48 version fixes your issues?

I dropped most of the generation logic from the module in favor of a npx nuxt-edgedb-module command that guides you through generation & setup and also avoids to add that in the Nuxt process, making it unreliable.

Could you let me know if that helped you?

Sorry it took some time, but I'm having a lot of work lately and our EdgeDB setup is now stable at my company.

ivanparramartinez commented 5 months ago

Hi Yaël! I'll update to that version and I'll let you know if everything goes right! Thank you so much!

ivanparramartinez commented 5 months ago

I updated the module, and deleted node_modules and nuxt cache and performed pnpm install again and the npx nuxt-edgedb-module, but the error remains.
Captura de pantalla 2024-06-18 a la(s) 11 35 52 a  m Captura de pantalla 2024-06-18 a la(s) 11 36 00 a  m

Tahul commented 5 months ago

Could you try 0.0.49?

ivanparramartinez commented 5 months ago

Yes. I'm doing it and the useNitroApp is already gone but now there is another issue Captura de pantalla 2024-06-18 a la(s) 12 05 07 p  m

Tahul commented 5 months ago

I just pushed 0.0.50 ; could you try it?

ivanparramartinez commented 5 months ago

Yes, I just did it. But I have some doubts. Why those endpoints give me this:

Captura de pantalla 2024-06-18 a la(s) 12 14 41 p  m Captura de pantalla 2024-06-18 a la(s) 12 14 35 p  m
Tahul commented 5 months ago

I just double checked and reinstalled everything from scratch in a new repository, following what you can find in playground/ directory.

I followed the readme as is, and ended up with a working authentication using GitHub app.

These responses seem partially okay (the callback shall be a No Content; but identity should return an object w/ id).

I would appreciate a reproduction repository, or a better highlight of your exact issues in here.

Ensure you have properly setup the .env variables for OAuth; here is what mine look like:

# Your EdgeDB instance auth extension base URL
NUXT_EDGEDB_AUTH_BASE_URL=http://localhost:10702/db/edgedb/ext/auth/
# Your EdgeDB instance OAuth callback URL
NUXT_EDGEDB_OAUTH_CALLBACK=http://localhost:10702/db/edgedb/ext/auth/callback
# Your app callback page
NUXT_EDGEDB_OAUTH_REDIRECT_URL=http://localhost:3001/auth/callback
# Your app app reset password URL (receiving the token from the forgot password email)
NUXT_EDGEDB_AUTH_RESET_PASSWORD_URL=http://localhost:3001/auth/reset-password
# Your app email verify url (receiving the token from email verify feature)
NUXT_EDGEDB_AUTH_VERIFY_REDIRECT_URL=http://localhost:3001/auth/verify
ivanparramartinez commented 5 months ago

Thank you very much Yaël. I'll try to do the same and see if everything goes better.

ivanparramartinez commented 4 months ago

After everything you've done, Yaël @Tahul, I got to make it work like a Charm. Thank you! I have one more question. Does the module have support for passkeys and magiclinks?