Serve dynamic content based on authentication state with Firebase

  • Is there any way to serve dynamic content using Firebase Functions based on if the user is authenticated or not?

    Basically, how do I get the authentication state of the current user without passing in a request in Firebase Functions?


  • The client has to send an id token to the backend, whether it is Cloud Functions or some other service. There is no way to avoid doing that if the backend needs to know something about the user signed in to the frontend.

    You can use a callable function to automatically send this ID token from your client code, when the user is signed in, but it is still always being sent. In every other case, you must arrange to send this token yourself.



  • S

    I have a use-case involving Arabic text in a game, with custom font. I am currently using the createWithTTF API call, and selecting the Font file that I would need.

    However, since Arabic is a Right to Left(RTL) language instead of a Left to Right(LTR) language, the texts are getting printed incorrectly. Apparently, the best solution for this is to use the createWithSystemFont API call. However with this call, I would not be able to use a custom font and I would have to resort to a system font.

    Is there any way that you guys know in Cocos2DX to use a custom font, with Arabic text? I did look into this Github issue. I tried the Arabic Writer out, but this gives glitchy output in certain cases. I know that editing the source JSON/Plist file is an option, and I have tried using reversed Arabic strings in the source. However, since Arabic is a language that has combined characters, the result that I get on my UI is not 1:1 with the expected result, and some characters are disjointed(which are supposed to form a special character after getting merged).

    Looking for suggestions on how to tackle this. I have looked into almost all open threads related to this, and could not find anything conclusive. Thanks!

    read more
  • S

    I have word network plot and want to keep digits so they are plotted. When I use strip and set digit.remove to false it removes digits. I have used the apostrophe.remove set to true and to false to see if that works and it does. Wondering what might be going on. I have also tried using the replace_number function and that works, so it changes the digits to text but I want to keep the digits as is. Thanks!

    word_network_plot(strip(blank$`Search Term`, digit.remove = FALSE), label.cex = 0.8, label.size = 1.5, edge.curved = FALSE, edge.color = "gray70", log.labels = TRUE, plot = TRUE)

    Would expect the default to not remove digits (would think strip would only be necessary when I want to remove the digits (so having it set to true)). The default removes the digits and adding this extra bit to the code also doesn't help. When looking at the blank dataframe, the digits are shown in there but not in the plot.

    read more
  • S

    I am playing around with msdb.dbo.sp_send_dbmail to send emails from SQL Server.

    My goal is to send emails to one or more distribution lists (that may or may not have an alias to their email address). While it works if I use the distribution list's actual email address (example below), I am curious if anyone knows if the alias of the distribution list can be used as a valid recipient?

    What works (basic test):

    exec msdb.dbo.sp_send_dbmail @profile_name = 'MyProfile', @recipients = ';', @body = 'Test email body', @subject = 'Test email subject';

    What I am trying to see if it might work (from what I tested so far - no luck):

    exec msdb.dbo.sp_send_dbmail @profile_name = 'MyProfile', @recipients = 'Team Lorem Ipsum;', @body = 'Test email body', @subject = 'Test email subject';

    I looked over the stored procedure's MS documentation and apparently this is not possible. Also found a thread here that says it isn't possible but it's pretty old (2010) and I am wondering if a workaround appeared since(?)

    Thanks in advance for your input!

    read more
  • S

    If you redeclare variable with var, it has the scope in the whole function. If you do it with let instead of var, it will be available only in the if scope.

    var name = 'John'; function foo() { if (false) { let name = 'James'; } console.log(name); } foo();

    read more
  • S

    Yes this is because the variables declared with var have function scope and they are hoisted to the top of the function. It logs undefined due to hoisting.

    Variables declared with let have block scope so until the if block is not executed the variable name is not declared.

    Even if you change it with if(true) it will not work because the variable will only be available inside the block. {} not outside.

    Here is the example how let works.

    <pre class="snippet-code-js lang-js prettyprint-override">``` if(true){ let x = 3 } console.log(x);

    read more