Giter Club home page Giter Club logo

Comments (14)

maebeam avatar maebeam commented on June 12, 2024

You should direct the user to bitclout.com or yourbitcloutnode.com. bitclout.com embeds the identity iframe which you should be able to communicate with. If you run your own site, all it needs is an iframe with identity.

Open to ideas for making this easier if you have any

from identity.

maebeam avatar maebeam commented on June 12, 2024

Actually, you might just be able to load identity.bitclout.com/embed in a WKWebView and it will support everything you need. Give that a try

from identity.

ryanjohn1 avatar ryanjohn1 commented on June 12, 2024

from identity.

BobbyTable avatar BobbyTable commented on June 12, 2024

@maebeam Are there any docs on this intended usage (Iframe + message posting)? Just a sentence or three would be very helpful.

from identity.

maebeam avatar maebeam commented on June 12, 2024

I think what you want is a webview of /embed and WKWebView.evaluateJavaScript. We want to encourage app developers to use identity.bitclout.com to log users in and sign transactions so that the user has a single place to manage all of their identities and they don't need to enter their seed phrases into random apps/websites.

from identity.

maebeam avatar maebeam commented on June 12, 2024

For example: on a WKWebView of /embed, run

webView.evaluateJavaScript('
  window.postMessage({
    service: 'identity',
    id: 'uuid-v4',
    method: 'sign',
    transacitonHex: '12345',
  })
');

You'll need to submit a pull request to this repo to support a "webkit embed view" that sends responses to webkit instead of to the parent window. This could be triggered with /embed?webkit=true or even /webkit-embed if the logic diverges significantly. For example:

webView.configuration.userContentController.add(self, name: "jsHandler")

and

window.webkit.messageHandlers.jsHandler.postMessage("trigger from JS");

If you want to get fancy you can make a Swift library that does this all behind the scenes so other app developers don't need to set any of this up.

from identity.

maebeam avatar maebeam commented on June 12, 2024

The intended usage for this service in a web browser is very easy. Just put /embed in an iframe for signing transactions. For logging users in, use window.open('/log-in') and listen for a response.

from identity.

andyboyd avatar andyboyd commented on June 12, 2024

Actually, you might just be able to load identity.bitclout.com/embed in a WKWebView and it will support everything you need. Give that a try

I've tried this, but it immediately redirects to https://bitclout.com

from identity.

mubashariqbal avatar mubashariqbal commented on June 12, 2024

(Sorry if this is off topic)

I'm trying to implement login with BitClout in a web app, but when I window.open identity.bitclout.com/log-in I just get a blank page.

Are there any particular parameters I need to pass over from my own domain or other setup I need to do?
Screen Shot 2021-04-28 at 12 27 00 PM

from identity.

ryanjohn1 avatar ryanjohn1 commented on June 12, 2024

I've been testing on Android (using a Webview within my app) and I have the same issue as @andyboyd, when I navigate to identity.bitclout.com or any of the paths such as /embed it redirects to bitclout.com due to the code at the start of ngOnInit in the app component. I'm guessing these checks are there for security purposes? They may need to be changed to allow Webviews to work.

Working around that issue on localhost I've made some progress. Though I've had to deal with responding to events such as initialize being fired out as they expect bitclout.com to be responding to them otherwise the rest of the code doesn't execute.

from identity.

mubashariqbal avatar mubashariqbal commented on June 12, 2024

Not sure if it's helpful or not, but I was able to get Login with BitClout working for my web app, I posted a very basic POC here:
https://github.com/mubashariqbal/login-with-bitclout

Might be helpful for mobile apps developers too.

from identity.

maebeam avatar maebeam commented on June 12, 2024

@ryanjohn1 @andyboyd i am happy to remove the redirect. it's not for security, just convenience.

from identity.

maebeam avatar maebeam commented on June 12, 2024

but i am pretty sure you will still need to add support for calling webkit handlers instead of parent.postMessage

from identity.

ryanjohn1 avatar ryanjohn1 commented on June 12, 2024

from identity.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.