PhantomAppDevelopment / firebase-as3

Integrate Firebase Auth, Realtime Database and Storage in your Adobe AIR projects.
MIT License
55 stars 12 forks source link

A couple of requests #14

Open adam-law opened 7 years ago

adam-law commented 7 years ago

Great work on this 👍

Although it's for AS3, you were right when you said that it's easy to adapt to other languages :)

I was wondering if you could provide the processes to sign a user out of firebase, and link accounts as described on this article?

Thanks!

agentphantom commented 7 years ago

Thank you!

What I normally do to sign out of Firebase is just delete the object/dictionary/map where I store the Firebase Access Token.

In the official SDK it probably does the same since I haven't found a Sign Out method on Google Identity Toolkit.

For the Link/Unlink, I haven't tried those yet. I will give them a shot this weekend and update the guides accordingly.

adam-law commented 7 years ago

Thank you for the quick reply :)

Ah, I figured as much. What I did was to nullify the access token in my application. I'm glad to hear that you take the same approach.

I can't wait to see what you come up with. Even when following the JS guides for web, sometimes the whole process doesn't synergize too well e.g. Google w/ Facebook or vice-versa, but It's likely user-error on my part.

Good luck!

agentphantom commented 7 years ago

No problem!

Actually, there's a "bug" when logging in with Facebook and Google on the same account. You can take a look at the other issues on this repository for a more detailed reference.

My recommendation is to not enable Google and Facebook on the same project or add a conditional telling the user to log with Google.

adam-law commented 7 years ago

Oh yes, I did read that section when I was trying to figure things out for that issue, and yes, going Google was the answer, though it still causes some "funkiness" on the JS events I hooked up as listeners.

By the way, I'm sorry to ask an unrelated question, but I'm currently using your Firebase Database guide and successfully implemented it on my application.

Under the Adding Data section, my question is, is there a way to specify the key/id for the addition, instead of letting Firebase generate it? This is easily done on the Web API, so I'm wondering if this can also be accomplished via REST. With a user-specified key (e.g. email address), I can perform simple on-key comparisons, as opposed to digging through the entire JSON, to match what I'm looking for.

agentphantom commented 7 years ago

Yes, you can specify the node name (key) using REST, you only need to modify the url in a PATCH request (POST requests are the ones that autogenerates the key):

From this:

https://<YOUR-PROJECT-ID>.firebaseio.com/journal.json

to this:

https://<YOUR-PROJECT-ID>.firebaseio.com/<your-desired-key-name>.json

A PUT request also works, but I don't recommend those because they delete all values that are not set in the request.

adam-law commented 7 years ago

Agh, I should have said sub-node. But if I read that section and got your example correctly, if I want to affect the sub-node I'd just need to do

https://<YOUR-PROJECT-ID>.firebaseio.com/<node>/<sub-node>.json

yes? I'm trying it out right now, just putting my comment here for others to reference :)

agentphantom commented 7 years ago

Yes, exactly!

As an additional note, if you go deeper:

https://<YOUR-PROJECT-ID>.firebaseio.com/<node>/<sub-node>/<another-node>/<another-subnode2>.json

All those sub nodes will be created automatically when you PATCH something to another-subnode2.

adam-law commented 7 years ago

Awesome! Thanks for the tip! :)