[SOLVED] Angular Moralis v2 Authentication

Hi folks, I need some assistance. I currently have an angular dapp using the moralis-v1 package to connect to meta mask, displays balance, NFT’s, user details.

I have now upgraded to moralis v2 package but I cant seem to find any support for angular and v2 of the library. I was wondering does anyone have code samples or examples using angular and v2. I see there is a very good nextjs example on the moralis doc which covers areas such as, isConnected, User, authorsied etc, I would love to have the same for angular and the v2 package version.

Can anyone help?

Thanks David.

The next js tutorial which you have referred to must be using wagmi or rainbow kit package for connecting to wallets. v2 sdk does not provide any functions or hooks to connect with wallets. So you have to use other packages to handle the web3 wallet connection on client side.

This is the exact area im looking at. The wagmi package for nextjs is giving the client side hooks that i would like for angular.

Have you came across any useful packages to handle the web3 wallet connection on the client side for angular?

I don’t know any such packages for angular.

You can try using @wagmi/core which is what wagmi (React) uses.

Similar thread here for someone using Angular.

1 Like

thank you glad, im going to try that here now, will let you know how i get on, thanks David

I have the same problem. I’ve used WalletConnect and MetaMask previously and set the AppID and ServerURL for the managed server as environmental variables.

Now I need to find an alternative. Would be happy if you share your knowledge if you’re able to solve it.

If you self host, you can still use the same moralis-v1 and react-moralis libraries. Check out the self-hosting guide. Please make a new thread if you have any questions that aren’t related to Angular and using Moralis 2.0.

Hi @alex following up with progress on this with Moralis V2 and angular. Ive gotten a little further but gotten stuck again.

Ive checked out the other post using wagmi/core ( React ), but I cant get the connector to work. Im getting the error MetaMaskConnector is not assignable to type connector. This is the same error as the user on the other post is getting, though he seems to have fixed it, but didnt post how he did that, would you happen to know?

Can you share a repo of where you have gotten up to e.g. setting up a login button on a page to try and use @wagmi/core with the connector. I’m not that familiar with Angular.

You can post in the other thread and ask for any updates.

1 Like

Hi @alex Ive made more progress on this. Ive moved away from using wagi mainly because its react based and Im working with Angular. I felt this was a bit flaky for a product app and i needed more stability.

But i do have a new problem, maybe you could help with. Im using the web3auth libraries and following the Moralis example found here: https://docs.moralis.io/docs/sign-in-with-web3authio

When it comes to connecting to the moralis server im getting a SDK core error, saying the serveR URL is unregisteredScreenshot 2022-11-08 at 00.43.58

Can you share a repo or all the related code? Different things can cause this error so more info is needed.

Apologies, I was away on a business trip. I will get this pulled together this evening in a repo and sent it over to you with a link.

We now have two guides for Angular:

1 Like

Awesome thank you so much, working through these here now, will let you know how i get on/

Hey @alex Ive got the wagi/core interceptor firing now inside our angular app and it can successfully connect to my metamask, this is great news. Thank you for this guides they where great.

Ive got a new bad request issue which is blocking me, I will create a new thread here as its not javascript related