Adding Blockstack Authentication to a Centralized App


#1

As many of you know, you can sign in to the Discourse instance that this forum is built on using Blockstack ID. I wrote a blog post that goes over the work that needed to be done to enable Blockstack Authentication in a traditional client-server app like Discourse.

I hope this post helps those of you interested in adding support for Blockstack Authentication to your own client-server app.


What kind of form are you using
#2

I wonder if there is a way we could implement Blockstack to be used as an OAuth2 provider. This would simplify it quite a lot, and one could add some custom fields as well to pass on Gaia information if the app requested it.


#3

You could make a server that acts a Blockstack auth oauth2 provider and then apps using that server would be trusting it to identify users.

Not sure how that would simplify things, it would require an additional server or 3rd party service which really defeats the purpose of decentralized identity.


#4

DEFAULT_API = ‘https://core.blockstack.org

Is the idea to host a atlas node and do local lookup to be decentralized? If using https://core.blockstack.org it seems pretty centralized. Why not do OAuth2 in this case?


#5

The idea is that each app chooses their own Blockstack core node. If you’re using this library in a production app, you should probably also be running your own node and configuring own.

You can see that in our Omniauth Strategy, the blockstack ruby library is configured to use the Blockstack Core node specified in the strategy configuration:


#6

What if I have an Android app to integrate? Do I have to implement verifyAuthResponse function on my own, or is there any other way to do it (such as requesting it as a feature in Android SDK :slight_smile: )?


#7

That function should be implemented in thr Android SDK, however in a centralized client-server android app you’d need that logic to exist on your server, not on the client. If authentication logic is on the client the user can trick your server into thinking she is someone else.


#8

In which function it is implemented? I couldn’t find a function with the same name in the SDK.


#9

You can use the handlePendingSignIn method which calls the verifyAuthResponse function as part of the implementation.


#10

I think Blockstack as an OAuth provider would be quite attractive. These days I would trust Blockstack more with my OAuth login than I would trust Google. But I can’t ask the various sites I’m registered on to implement a completely new login path. However I might be able to convince them to enable yet another OAuth service, which will require minimal work to change, especially if they’re using some standard auth library like omniauth or hybridauth.

Longer term, once Blockstack’s properly decentralised login is supported by those same cross-service libraries, the OAuth option would gradually be rendered unnecessary.


#11

We have an omniauth strategy available already. Using that strategy directly in omniauth shouldn’t be any more or less work than an oauth-based strategy.