Nilom's Recent Forum Activity

  • I think this will not happen if you use sub events for the following code blocks. At least I vaguely remember that I had this similar problem. But I'm not sure.

  • Hello past me.

    I don't know how but I got an enlightenment and figured it out by myself.

    You just need the Facebook access token which you get using Construct 3's built in FB plugin + you need Web Facebook or something similar to get the access token (Why don't we have this important feature built in?)

    Just set the global variable access_token to WebFacebook.GetAccessToken inside the facebook on logged in condition.

    Then add script and paste the following code (You must have the Realm Web SDK loaded):

    const id = "your-realm-app-id";
    const config = {
     id,
    };
    const app = new Realm.App(config);
    
    
    const credentials = Realm.Credentials.facebook(runtime.globalVars.access_token);
    
    app.logIn(credentials).then(user => {
     
     console.log(`[Realm] Logged in with id: ${user.id}`);
     
    })

    It must look like this:

    And this:

  • Hey there!

    With the help of DiegoM I was able to install Mongodb's Web SDK into my project.

    But now a new problem has arisen. My plan is to build a mobile app, exporting to Cordova. But then obviously redirection from the Realms Web SDK built in OAuth2 Facebook Login will not work anymore. Also I'm not sure if the built in functions of the Web SDK will work inside Cordova. They might though, as Cordova is just a browser app, if I'm not wrong.

    My problem now is to let the user sign in to Mongodb Realm using the SDKs built in Facebook OAuth2 without redirection.

    (The next problem will be using API calls or the built in SDK to retreive and post Database information as the Realm documentation, although pretty detailed, lacks very much of detailed code examples. There are just confusing variations of incomplete code snippets for the same thing scattered across multiple sites. But that will be the next step and maybe part of a future question when I get the sign in with Cordova working. :D)

    Any ideas?

  • DiegoM

    Wow this is super awesome! You even made an example for me. <3

    I'm really looking forward to returning home later so that I can test it.

    Edit:

    Thank you again so much for your help and efforts. It works perfectly that way! Now I just have to figure out how I can handle the redirection-url-thing.

    My first guess would be to check the apps url on start of the layout. If it contains the redirect information, then handle Realm.handleAuthRedirect(); and if not do the login stuff to get logged in and redirected.

    About the installing SDK part: Even though it is relatively advanced and pretty nieche I think it might be worth to include this to the example projects as it is very powerful to be able to install SDKs. :)

  • Any ideas?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Hello.

    I want to install the Mongodb Realm Web SDK into my client so that I can use its authentication and other features.

    How can I do this? I was following this documentation but I just don't know how to do this in Construct 3 (or in general, lol).

    Thanks in advance!

  • Thank you very much!

    Still figuring this out. But now I have new hope to get it to work.

  • Thank you!

    But is it not possible natively? Because I can not know how reliable external plugins will work after several Construct or Browser updates.

  • Hey there!

    How do I get the users Facebook Access Token after signing in to Facebook through the Facebook plugin?

    I have a hard time figuring out how I can let the user sign up a new account with Facebook and then let the User/Client use API calls to MongoDB Realm with its implemented Facebook authentication.

    So I thought I could maybe use the Access Token which I send to MongoDB Realm via API call.

  • That's an interesting idea. I will look into this if I need it.

    For now I just load Base64 into an ImageMemory library.

  • Hello!

    I came across this topic https://www.construct.net/en/forum/construct-3/how-do-i-8/load-binarydata-dictionary-151643.

    dop2000

    You can store different images in BinaryData under different tags, which is very similar to the dictionary.

    Can someone please tell me how to do this? Or was this feature removed? I'm not able to find the place where I can define tags for the binary object.

    I need this for loading images from local storages binary data. Otherwise I would need to use a dictionary and store the data as Base64.

    Or maybe use JSON if it is able to hold binary data (is it?).

  • Hello there!

    I have a big issue.

    I'm building a deck editor. I'm using a websites API to load the card images. The owners of the website state that they will ban and blacklist people who download/request too many images per second.

    For this reason I want to create an image cache for these images and only request them if they are not found in the local storage as binary data.

    But the whole thing ends up with a lot of synchronisation issues because of the asynchronous local storage and load image from url (binary data). All cards images always get the same, even with different animation frames set.

    .

    Because the process is complicated I will try to describe the event page as detailed as possible:

    1. On start of layout the online card database version will be checked and compared with the local one. If outdated or missing it will be redownloaded.

    .

    2. The first time the database is downloaded all the data is rearranged in a new json with the card id's being the paths. (Because loaded decklists only contain the cards id)

    .

    3. When a deck is imported the decks card id's are read and for every one of them a sprite instance is spawned with the id as a local variable.

    .

    4. While spawning the sprite (the card) the local storage is searched for a key named like the id of the card. For example 53439220. If it is found then the binary data will be read and the image will be loaded from binary url. (problem: all cards will always get the last image -_-)

    .

    5. If no key with the cards id is found in local storage the sprite will be loaded from image url (from the online api) and this binary data will then be stored as the cards id as a key name to the local storage.

    I tried so many things.

    - Using functions

    - Without functions

    - Setting different animation frames based on object count, loop_index, incrementing

    - Looping through all objects, comparing their id and then setting image from url after Local Storage get is complete

    - Much more that I can not even remember

    .

    Here is what I have so far. I rearranged and changed it a lot so there are many events disabled. But I think you can see what I tried there and what I want to do.

    Any ideas on how this can be solved?

    I just want to be able to load image from url individually for each sprite. =(

    Thank you in advance!

Nilom's avatar

Nilom

Member since 26 Dec, 2019

Twitter
Nilom has 1 followers

Trophy Case

  • 4-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • x2
    Great Comment One of your comments gets 3 upvotes
  • Email Verified

Progress

9/44
How to earn trophies