https://linen.dev logo
Join Discord
Powered by
# openfl
  • d

    damp-artist-60225

    03/20/2023, 2:01 PM
    ah
  • a

    ambitious-knife-25690

    03/20/2023, 2:01 PM
    right idea, just wrong approach. You can access
    Browser
    through haxe, typed
  • d

    damp-artist-60225

    03/20/2023, 2:02 PM
    so no need for the
    Syntax
    thing
  • a

    ambitious-knife-25690

    03/20/2023, 2:02 PM
    nope, not at all
  • a

    ambitious-knife-25690

    03/20/2023, 2:02 PM
    at least in this context
  • a

    ambitious-knife-25690

    03/20/2023, 2:02 PM
    there may be some context where that would be useful
  • d

    damp-artist-60225

    03/20/2023, 2:03 PM
    ok, got it
  • d

    damp-artist-60225

    03/20/2023, 2:05 PM
    I'll see if I can figure out the rest then
  • e

    elegant-twilight-61392

    03/20/2023, 2:05 PM
    Browser.document.createDivElement()
  • a

    ambitious-knife-25690

    03/20/2023, 2:06 PM
    here's a lil example
  • d

    damp-artist-60225

    03/20/2023, 2:06 PM
    I need to add something like
    Copy code
    <div id="g_id_onload"
         data-context="signin"
         data-ux_mode="popup"
         data-callback="signInCallback"
    </div>
    , not sure how to add the parameters
  • a

    ambitious-knife-25690

    03/20/2023, 2:08 PM
    oh lol, that prop list is tiny
  • a

    ambitious-knife-25690

    03/20/2023, 2:08 PM
    ahh nvm
  • a

    ambitious-knife-25690

    03/20/2023, 2:08 PM
    it extends domelement
  • e

    elegant-twilight-61392

    03/20/2023, 2:09 PM
    div.id = 'whatever'
    and
    div.setAttribute('data-key', 'value')
  • d

    damp-artist-60225

    03/20/2023, 2:10 PM
    nice, seems easy enough 😄
  • e

    elegant-twilight-61392

    03/20/2023, 2:10 PM
    my cat seems interested in this discussion lmao
  • d

    damp-artist-60225

    03/20/2023, 2:10 PM
    lol
  • d

    damp-artist-60225

    03/20/2023, 2:20 PM
    I tried it in my game but nothing appears 😕
  • d

    damp-artist-60225

    03/20/2023, 2:20 PM
    Even this from the example doesn't show up in the game:
    Copy code
    var button = Browser.document.createButtonElement();
                button.onclick = (event) -> Browser.alert("Hey");
                button.textContent = "Click";
                Browser.document.body.appendChild(button);
  • d

    damp-artist-60225

    03/20/2023, 2:22 PM
    ah, I might need to position it; the button appears below the game when I don't scale it to fullscreen
  • d

    damp-artist-60225

    03/21/2023, 7:35 PM
    Well, after trying several approaches, I'm about to give up. The closest I got to getting it to work is by including the google sign-in divs in the index.html template directly (from the Haxe code it doesn't show for some reason), and I can't get it to appear over the game, only above and below. This might be acceptable, if I could at least set the callback attribute of one of the divs to a function I can control from the Haxe code.
  • d

    damp-artist-60225

    03/21/2023, 7:36 PM
    But I suspect there's no way to do this?
  • h

    hallowed-forest-58641

    03/21/2023, 7:52 PM
    Well, I think is possible to call js function for login in html5. At first you should have a project in Google console 1) Then you should add this script on your page 2) After that init google oauth2 client. For example: client = google.accounts.oauth2.initCodeClient({ client_id: 'YOUR_GOOGLE_CLIENT_ID', cookiepolicy: 'single_host_origin', scope: 'profile email', // and so on ux_mode: 'popup', auto_select: true, callback: (tokenResponse) => { // id : profile.getId(), name: profile.getName(), image:profile.getImageUrl(), email: profile.getEmail(), // tokenResponse.code } }); 3) Call this when user click on button to login--> client.requestCode(); The other way will be to use access_token. More info check here: https://developers.google.com/identity/oauth2/web/guides/use-token-model Or check documentation here : https://developers.google.com/identity/oauth2/web/guides/overview Hope that's help. Good luck !
  • d

    damp-artist-60225

    03/21/2023, 8:55 PM
    Ah, it seems I don't need to use Google's button after all? This is very helpful, thanks!
  • d

    damp-artist-60225

    03/21/2023, 9:03 PM
    I think I have it almost working, just not sure how to get the profile info yet 😅
  • b

    bored-psychiatrist-68708

    03/21/2023, 10:04 PM
    not sure if that'll help but there was a post on the forum about this, you might want to ask there too https://community.openfl.org/t/google-oauth-display/13674
  • d

    damp-artist-60225

    03/21/2023, 10:56 PM
    Thanks, but I think (hopefully) I have everything working now... I can call the api directly, and I got the profile info by sending the authorization code to my server and getting a token which contains all the info. 😄
  • f

    future-iron-61487

    03/23/2023, 4:44 AM
    oh god I hate websites that embed google's sign in code; Google remotely changed the code so it does an annoying popover now.
  • f

    future-iron-61487

    03/23/2023, 4:44 AM
    if you can do it with your own UI that'd be so much better
1...464748...57Latest