Using Blockstack Auth with NodeJS environment

#1

Hello,

I’d like to incorporate Blockstack Auth as an identity provider and authentication service for getherd.app.
The strategy I’m looking for would ideally match the following pattern:
user arrives at getherd.app, clicks sign-in, is directed to a pop-up to login w/ blockstack, successful login sends a jwt to my nodejs backend to be verified, verified user updates some data about themselves upon successful login, continues to use the app

Is there an example of this type of implementation?

#2

I figured this out.

I received a token on the front end using the standard auth procedure, the token was stored in my url.
I captured this token in component did mount and passed it to my backend where I used the verifyAuthResponse function to verify that the user was authenticated via blockstack and who they were. Once this was done, I created a jwt token, if the use wasn’t created in my system, I created them, and passed the token to the front end so the user could securely log-in to the app.
I referenced the updated apis at https://blockstack.github.io/blockstack.js/globals.html

I was having some trouble verifying the token that I received on the front end via my backend server, but I found that I was using an incorrect package (as per the app.co build) After I switched the location of verifyAuthResponse to the correct package, it worked and I was able to verify the user.

1 Like