Fetch Bearer from username and password

,

Hi,

let us suppose that the user is in Unreal Binary and should fetch the data with the Unreal plugin in Runtime. The user provides the username and password and then ???

How can I fetch the Bearer from username and password ?

Alternatively, the Bearer is well hidden in https://speckle.xyz/graphql
can you put it in https://speckle.xyz/profile
?

Best,
Dimitrios Ververidis @ PrismArch

1 Like

Hi @Dimitrios.Ververidis!

Please correct me if I’m wrong, but I’m guessing you want to allow users to “log in with speckle” on an Unreal app. Not sure about the Unreal-specifics, but you should have to implement an OAuth workflow. We may need to document the process a bit more in the docs, but here’s the gist of it:

First you must create an app on your Speckle server user profile. Then the user would:

  1. Click the “Login with Speckle” button
  2. User is redirected to the auth page in the Speckle server (using the provided url pattern when creating an application)
  3. User will log in and allow the app to access his data.
  4. User is redirected to our specified Redirect URL, with an attached access_code.
  5. Using that access code, we can exchange it for a pair of token/refresh token, which is what allows the app to “talk” to the server as that user. Then you can save that token/refreshToken pair wherever you need.

This way, the user will never disclose it’s credentials (username/password) to your application, as the authentication is done in the Speckle server. Your app is only responsible for exchanging the access_code and saving the token.

This is implemented in our “Creating your own app” guide:

https://speckle.guide/dev/apps.html#login-in-with-speckle

Specifically here: speckle-demo-app/speckleUtils.js at bf6d2bb681fc93dfe54ece50266fc69769367b8a · specklesystems/speckle-demo-app · GitHub

Although it’s JS and the implementation details may change, the overall flow would remain the same. Maybe someone more knowledgeable in Unreal (looking at you @Jedd :grinning_face_with_smiling_eyes: ) can give you some insight on how this could be done there.

1 Like

Yes, I know the procedure, but in terms of usability in VR, the user can not leave the VR environment and go to 2D mode. There of course a webview in Unreal but it is obsolete (Chrome 59 if I remember correctly). It is a burden. There should be something more easy. For the time being I go to graphql and I copy the Bearer from the header to my Blueprints in Unreal.

1 Like

Hi @Dimitrios.Ververidis, unfortunately there’s no shortcuts to be had here due to security issues - we do not allow the password grant flow as it’s flagged as obsolete by the standard itself (for good reasons). You would need to register your app on the server first and go through the auth flow - if the user is already logged in the frontend, it will just ask a simple allow/disallow question (the app should work fine in chrome 59).

The only way that could work “better” would be to have the end user install speckle manager and add an account locally first, and then the unreal application can read those accounts and use their credentials without the need for authentication from within the app.

4 Likes

Referencing the speckle manger would work well for PC VR apps but would be a bit of an issue with anything on mobile VR. @Dimitrios.Ververidis were you thinking of making a mobile speckle viewer for unreal ? I’m starting a similar process from unity but didn’t consider this as a potential blocker. Maybe there is a solution with creating an .apk speckle manager ? But I think that comes back to the security deets @dimitrie mentioned

2 Likes

I agree with @haitheredavid here, Mobile/Standalone VR is the largest VR market and one we should consider supporting better in many ways.

I have a few half baked ideas about how auth can be made easier for mobile VR. (perhaps some QR code based delivery of personal access tokens??).

I would be intersted in hearing a little bit more about your use case @Dimitrios.Ververidis and @haitheredavid, and what kind user experiance you are looking for.

2 Likes

I think this calls for the device authentication flow, if i’m not mistaken - like the way you link your smart tv up with your accounts, or similar.

It’s not an easy undertaking server-side though, but you know, if enough people scream for it…

1 Like

To tell the truth, architects request so high level of detail (RTX) that mobiles can’t make it. We are strongly developing in Unreal that can export in apk with minimum graphics settings, so the point is how to make everything to work correctly in unreal runtime environment and then we will port to any device or OS. We have opened many issues like voice recognition in VR interfaces, sunsky settings, cesium maps, Speckle stream selection in maps-inventory, multiplaying, avatar representation, object editing interfaces, so the authentication is just another issue to deal with. I think Unity doesn’t worth the effort (although it is much easier to program, it does not have the required realism and speed). If you consider between Unity and Unreal, I would vote Unreal. Panagiotis from our team has made some development in Speckle Unreal plugin that were pulled in the official Speckle repo. Soon, we will make our project open source. https://prismarch-h2020.eu/

1 Like

Ohh would be interested to hear about the QR idea @Jedd :robot:! I was hoping to build out a VR viewer for the analysis tool I’ve built in unity. I’ve built out a kit and a couple of converters so the structure of this analysis can scoot it’s way into a speckle stream. Creating a VR viewer is something on my roadmap for this product, something that different peeps within sasaki could access from their headsets and explore the analysis.

But I also echo what @Dimitrios.Ververidis said regarding the level of detail. Programs like Enscape have set a standard for rendering quality that is really difficult to achieve with just mobile headsets. Tack on the typical state of these models being heavy and messy, it’s quite tricky to consider how the current chipset in the mobile headset would be able to support reading heavy speckle streams.

Looking at the link @dimitrie (it made me :scream_cat: ), I would almost say it’s not worth going mobile (yet!) and stick with PC VR. I’m sure there will be more request down the road for integrating speckle support into phones / tablets. Also, maybe we just consider WebXR ?