New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define authentication process for desktop blockstack apps #270

Open
alidcastano opened this Issue Oct 17, 2017 · 8 comments

Comments

Projects
None yet
4 participants
@alidcastano

alidcastano commented Oct 17, 2017

Hi, I'm building a desktop app with Electron and was aiming to offer support for Blockstack authentication and storage.

I was porting over the app and encountered problems with authentication specifically since the API requires a manifest uri and a redirect uri.

In regards to the second problem, @larrysalibra addressed it in the slack channel; I haven't had a chance to look into it, but I'll post his response here so it can be useful to others:

For a desktop app, you’d need to register a custom url protocol handler for the redirect. This is similar to how redirects between apps are handled between iOS apps. You’d set the redirect to be to your app to yourapp:// and browser will append the authentication response to it

In regards to the manifest uri, as Larry advised, I'm opening an issue to see how this should best be approached.

// cc @cryptocracy

@alvesjtiago

This comment has been minimized.

alvesjtiago commented Dec 21, 2017

@alidcastano @larrysalibra any news on this? Was hoping to build an electron desktop app for Blockstack's Bounty to Decentralize Communication but it seems that it's still not supported.

It's throwing an "Invalid Sign In Request" error on Blockstack's page and "unsupported browser" & "can not detect custom protocols on this browser" on the electron side.

@jackzampolin

This comment has been minimized.

Contributor

jackzampolin commented Dec 21, 2017

@alvesjtiago I think @cryptocracy has done some work on this.

@alvesjtiago

This comment has been minimized.

alvesjtiago commented Dec 21, 2017

Thank you @jackzampolin 😊 @cryptocracy were you able to get it working via blockstack.js or directly through the API?

@larrysalibra larrysalibra changed the title from blockstack authentication with desktop apps to Define authentication process for desktop blockstack apps Jan 12, 2018

@larrysalibra

This comment has been minimized.

Member

larrysalibra commented Jan 12, 2018

This blocks people trying to make desktop apps is something we should tackle soon. This will also inform the process for native mobile apps.

@larrysalibra larrysalibra changed the title from Define authentication process for desktop blockstack apps to Define authentication process for native/desktop blockstack apps Jan 12, 2018

@larrysalibra larrysalibra changed the title from Define authentication process for native/desktop blockstack apps to Define authentication process for desktop blockstack apps Jan 12, 2018

@alvesjtiago

This comment has been minimized.

alvesjtiago commented Jan 12, 2018

@larrysalibra sounds great. After asking here, I've recently been able to integrate blockstack on a demo electron app (https://github.com/alvesjtiago/electron-blockstack-demo). Happy to discuss how to ease the development for native desktop and mobile apps.

@larrysalibra

This comment has been minimized.

Member

larrysalibra commented Jan 12, 2018

@alvesjtiago great to hear! would love to discuss - have time to chat Monday afternoon (i'm in Hong Kong UTC+0800)? drop me an email larry at blockstack.com

@alvesjtiago

This comment has been minimized.

alvesjtiago commented Jan 12, 2018

@larrysalibra sure! I'll send you an email to schedule.

@larrysalibra

This comment has been minimized.

Member

larrysalibra commented Sep 5, 2018

This currently isn't on our roadmap - i've started a forum discussion here to determine if we should change this: https://forum.blockstack.org/t/blockstack-authentication-in-native-desktop-apps/6171?u=larry

In the meantime, the steps following steps should work to enable authentication in a native desktop app:

  1. Prerequisites:
  • Have a web app - app identity is tied to domain control, so you'll need a web app
  • Your native app needs to register a unique custom protocol handler like mycoolapp:
  • web app will need to have a redirect endpoint that that opens the native app using your custom protocol handler and sends the auth response token to it
  1. In the native app generate an authentication request using the makeAuthRequest method of blockstack.js
  2. redirect the user to blockstack:${authRequestToken} if the user has the blockstack native installed, otherwise redirect to http://browser.blockstack.org/auth?authRequest=${authRequestToken}
  3. User approves request and gets directed to the redirect endpoint of your web app that behaves as described earlier
  4. redirect endpoint opens native app
  5. native app using the handlePendingSignIn method

We haven't tried this out but let us know if it works and if this is something you'd like to see first class support for and why in our discussion thread: https://forum.blockstack.org/t/blockstack-authentication-in-native-desktop-apps/6171?u=larry

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment