Check nft by wallet then Firebase auth

Hi friends,

I am trying to build a token gated site for my nft community members to upload files to firebase cloudstorage, read/write some data in firestore etc.

I have went through both the nextjs and the firebase auth tutorials provided by moralis and was successful in building both.

However, my issue now is how do I first check that the user has a certain nft then I sign them in to firebase?

Do i request the signature via metamask and check if user has our nft first then call the issueToken api for firebase auth?

But this function (signInWithMoralis from '@moralisweb3/client-firebase-evm-auth) actually does the request for message and token. Should i use axios to call the issuetoken api only instead?

Or any other advice would be great.

Thanks and I appreciate the help! quite new to front end development.

there are multiple solutions, you could update the authentication code to check the signature and to check the nft ownership at that point, or you can let the user authenticate and then check if he has an nft and show different pages based on the result of having that nft or not