1. ... if nobody uses my sharing extension within an hour of signing in, it seems like the tokens will have expired and be useless. Is that correct?
Is there a better solution available? Is there a better solution on the horizon? I'd love to hear about either, and thoughts about my proposed solutions.
--Thanks,Bartholomew
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-talk+unsubscribe@googlegroups.com.
To post to this group, send email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/CAHaiWHME6CzE5j3_fyiKw7QR1AgLazxw%3Dwb0zRbYq99nQrSYYw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
1. ... if nobody uses my sharing extension within an hour of signing in, it seems like the tokens will have expired and be useless. Is that correct?Yes. This is exactly what happens behind the scenes in Firebase Auth. Auth ID tokens also expire every hour and we have to renew them. But we do this automatically, so that shouldn't be a problem for you. Once you exchange the custom JWT for an Auth ID token, we'll manage it from there.If you're trying to send those tokens to a server, send the Auth ID token instead of the expired custom JWT. These do auto-refresh, but if it's close to the hour deadline, you'll want to use getIdTokenForcingRefreshCompletion, I believe, to avoid the edge case where it expires between the time you send it and the server processes it.
Again, you only need the custom token long enough to obtain an access id. So this should be fine.
Be sure to consider phone number auth and anonymous auth. Another roll-your-own might be to sign tokens based on device id or similar (although I don't know how one would accomplish this yet).
If you're trying to send those tokens to a server, send the Auth ID token instead of the expired custom JWT. These do auto-refresh, but if it's close to the hour deadline, you'll want to use getIdTokenForcingRefreshCompletion, I believe, to avoid the edge case where it expires between the time you send it and the server processes it.I'm not sure I understand this, so let me try to spell out how I think it could work based on what you've said:
Is the "access id" the thing that goes into the "authorization" header (for authenticating with Firebase Functions) and the "auth" param (for the REST API)? Does that not expire?
Be sure to consider phone number auth and anonymous auth. Another roll-your-own might be to sign tokens based on device id or similar (although I don't know how one would accomplish this yet).Would phone number auth provide an alternative method for solving this problem, or is it simply a quick sign-in method that the user might not mind as much (and that works, unlike Google Sign In in an extension)?
Regarding your last thought, it appears that Apple have gone out of their way to make it impossible to obtain a unique device ID on an iOS device.
Another option just occurred to me, which might make all this "expiry" stuff go away:5. When APPEXT opens and doesn't have a logged-in user, have it use a custom url scheme to open up APP and have it dump a non-expired token into UserDefaults, then close itself.
--
You received this message because you are subscribed to a topic in the Google Groups "Firebase Google Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/firebase-talk/OtbDoPGm4zg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to firebase-tal...@googlegroups.com.
To post to this group, send email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/6df0614f-3b1c-4b08-a74a-67a79d31418c%40googlegroups.com.
Shai,
I hit two problems with the strategy you described:
- Getting back from the main app. It turns out there's no "I'm done with the app; close it now" command in iOS.
- Unless it's a Today extension, you aren't supposed to have access to openUrl. There's a way around that, but it might not pass muster on the app store.
I ended up sticking with the solution I posted on September 13th. I found it relatively straightforward to implement, and it solved the problem pretty effectively. I'm guessing a security expert could tell me why it isn't a good idea to have a secret code that doesn't expire, though I suppose one could add an expiry time and refresh strategy to cope with that.
Good luck! Let me know if you get stuck or have any questions, and I'll see if I can help out.
Bartholomew
--
You received this message because you are subscribed to a topic in the Google Groups "Firebase Google Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/firebase-talk/OtbDoPGm4zg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to firebase-tal...@googlegroups.com.
To post to this group, send email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/97aa7c1d-b636-492e-a7df-7c5e67250667%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/4587c63b-e636-459c-9ea5-f9e5a04898a0%40googlegroups.com.