I’ve implemented firebase email authentication in iOS. I’ve tested the functionality on 4 different iPhones, all running iOS 13.3.1, and it works in half of them and not in the other. For the half that don’t work, I receive an error message stating “Invalid Dynamic Link - Blocked”. I’m performing the same process on all iPhones and am connected to the same WiFi. I’m trying to understand what would cause this to happen? It’s clearly something on the phone that is preventing it from segueing back to the app after authenticating.
I had the same problem and in my case, it was that I didn't set the dynamicLinkDomain (it isn't on the firebase example).
let actionCodeSettings = ActionCodeSettings()
actionCodeSettings.url = URL(string: "https://XXXXXX.page.link")
actionCodeSettings.dynamicLinkDomain = "XXXXXX.page.link"
actionCodeSettings.handleCodeInApp = true
actionCodeSettings.setIOSBundleID(Bundle.main.bundleIdentifier!)
Related
I am working on a Xamarin Forms application and using an iPhone simulator to test the Firebase authentication using phone number. I have checked all project setup needed on to Console and inside the app but I am getting the
Method name: DidReceiveRemoteNotification
Information: {
"com.google.firebase.auth" = {
warning = "This fake notification should be forwarded to Firebase Auth.";
};
}
all the time. I know that because I am using a simulator I will have to go through recaptcha process for this that has also been done (Added Url Scheme for that). Any help or suggestion that can help me to get this problem sorted will be a great help.
I'm using the iOS LinkedIn SDK to log into my App and retrieve basic profiles.
All works perfectly fine the first time I login, until either I log out, or I close my App.
On attempting to log back into my App with LinkedIn: the usual redirect to the LinkedIn app takes place, but the permissions screen for my app doesn't pop up, it just redirects straight back to my app with the following error:
Error Domain=LISDKAuthError Code=5 "(null)" UserInfo={errorDescription=The operation couldn’t be completed. Software caused connection abort, originalDomain=LISDKServerError, errorInfo=PARSING_ERROR}
I can only successfully log back in again if I first close the LinkedIn App, before reopening mine.
Does anyone have an idea of what's going on please?
-This doesn't occur on all of my test devices!
-On the device that it does occur on, I also receive the same error in that scenario when running the sample App provided with the LinkedIn SDK.
-The LinkedIn App is up to date.
-The App id, bundle ids etc etc are all set, hence login success half of the time!
-I've tried calling [LISDKSessionManager clearSession] in numerous locations.
Cheeky framework fix alert.
Uncomment out the lines in LISDKSession.h
This allows the correct use of [LISDKSessionManager hasValidSession]
Which is an improvement on what we were working with.
Not yet tested with iOS12...
I had a similar problem. It was mainly reproduced only on iOS 12. The problem is that when you already have a LinkedIn application running, you will not be able to log in through their SDK in your application. On iOS 11, the second time you try to log in after this error, the authorization worked fine.
I solved this issue by simply showing the user an alert with a message about what he needs to do to authorize.
Here you can check an example of my implementation in Swift 4:
LISDKSessionManager.createSession(withAuth: ["r_basicprofile"],
state: nil,
showGoToAppStoreDialog: true,
successBlock: { _ in
// Your actions in case of successful authorization
}, errorBlock: { error in
guard let nsError = error as NSError? else {
return
}
if #available(iOS 12.0, *),
nsError.code == LISDKErrorCode.SERVER_ERROR.rawValue {
// Show alert to user with text - "Please, shut down the LinkedIn app and try login again"
} else if nsError.code != LISDKErrorCode.USER_CANCELLED.rawValue {
// Handling when user tap on Cancel button in LinkedIn SDK
}
})
I've been battling for a fix for this with LinkedIn for months.
There 'solution' is to kill off the SDK.
Taken from their 'Important updates to the LinkedIn Developers program and APIs' email December 2018:
"Authentication, SDKs, and Plugins: We are also deprecating several obsolete or seldomly-used products and technologies."
"SDKs: Our JavaScript and Mobile Software Development Kits (SDKs) will stop working. Developers will need to migrate to using OAuth 2.0 directly from their apps."
Uncomment this two lines of code in LISDKSession.h
- (LISDKAccessToken *)getAccessToken;
- (void)setAccessToken:(LISDKAccessToken *)accessToken;
In a large app which uses Firebase extensively, I'm trying analytics,
-FIRDebugEnabled is set fine.
The date/time on the devices is set correctly.
I have tried all of simulator, tethered device, and even building through to TestFlight.
The needed stuff is in app startup ..
FirebaseConfiguration.shared.setLoggerLevel(.max)
FirebaseApp.configure()
// helps Analytics get going:
AnalyticsConfiguration.shared().setAnalyticsCollectionEnabled(true)
Again, Firebase realtime and database works perfectly throughout.
So using Analytics.logEvent# ...
Note that the items appear perfectly in Xcode console:
2018-07-24 08:27:23.868 Blah[7501] <Debug> [Firebase/Analytics][I-ACS023105] Event is
not subject to real-time event count daily limit. Marking an event as
real-time. Event name, parameters: select_content, {
firebase_event_origin (_o) = app;
firebase_realtime (_r) = 1;
item_name = tapMyProfile;
firebase_screen_class (_sc) = Blah.SomeScreen;
firebase_debug (_dbg) = 1;
firebase_screen_id (_si) = 8314738347840858914;
item_id = Blah-tapMyProfile;
content_type = tapMyProfile;
}
or ...
2018-07-24 08:56:12.393306-0500 Blah[7501:135963] [Firebase/Analytics][I-ACS023073] Debug
mode is enabled. Marking event as debug and real-time. Event name,
parameters: select_content, {
firebase_event_origin (_o) = app;
firebase_screen (_sn) = MyProfile;
item_name = tapCamera;
firebase_realtime (_r) = 1;
firebase_screen_class (_sc) = Blah.OldDevDotScreen;
firebase_debug (_dbg) = 1;
firebase_screen_id (_si) = 8314738347840858915;
item_id = Blah-tapCamera;
content_type = tapCamera;
}
Notice tapMyProfile or tapCamera, one of my custom events from Analytics.logEvent#
Analytics as such does seem to be working perfectly:
so, those numbers update every few hours etc.
Again every item appears perfectly in the Xcode console ..
But no matter what, nothing will show up on the Firebase debug console!
Nothing!
What the hell could the problem be?
(Additionally I have waited a day or more and they don't show up as events either.)
How can it be that just nothing is showing up in Debug???
TL:DR - Delete your app from your device / simulator, rebuild and launch from XCode.
I faced this exact same issue even though Firebase and Firebase Analytics in particular seemed to be set up perfectly.
I cannot give the exact logical explanation yet as to why this worked, however one hint came from this Firebase events tutorial at around 5 mins 30.
He mentions that the -FIRAnalyticsDebugEnabled settings get saved to disk.
So after configuring & integrating Firebase, I ran my app which was already installed to test everything works fine and it did but the Firebase Console did not show me any messages of app events.
It's good to double check that you are not using special characters when sending your events and also not going over the character threshold, however even if you make these errors, you should see default events of screen_open, app_open, user_engagement which were not showing up for me.
My only theory is that launching the app from an already installed state does not impact the new settings of -FIRAnalyticsDebugEnabled.
So when I deleted my app, re-build and run from XCode, the events start showing up.
Finally, while testing, you might use another device and you might wonder, I was seeing my events from the previous device but nothing happens for the next one which baffled me for a few moments, remember to switch the device
However, in conclusion, I can say this behavior is far from reliable and because after a period of time (2-3 hours) when I ran my app again, nothing showed up on the Firebase Console again as if -FIRAnalyticsDebugEnabled had been disabled.
Deleting and reinstalling worked again.
Update for 2022
The above steps still applies. Just 2 more additions of why you might not see events you seem to be logging successfully:
Do a clean + build + run
There are some keywords that seem to not get logged because they are probably already in use by the Analytics framework. For example when I was trying to track a search event and one of the keys in my parameters dictionary was keyword and this never seemed to get tracked so use something else and give it a go
Check your device's time setting. Time needs to be accurate.
Did you enable Debug View for your app?
As per the docs, there is a minor difference on enabling debug events on the real-time and debug view that is embedded into Firebase Console UI.
To enable Analytics Debug mode on your development device, specify the following command line argument in Xcode :
-FIRDebugEnabled
For real-time logs on XCode console for the Arguments Passed On Launch section, add:
-FIRAnalyticsDebugEnabled.
It is been a long time since this question has been post. I have been struggling with this problem for over a week.
Everything was ok in my side, I saw it worked, like yours, in the Xcode debug mode. My issue was I did not look to the Debug View which is under the Analytics -> DebbugView in Firebase Console
Here is Debug View at the end of the analytics: Debug View
Documents in Firebase is here: In the firebase documents but the image is old.
It is in Analytics -> Debug View
Hope this will help someone!
Simply select which device you want from this "DebugDevice" dropdown menu. It's on the top left corner.
(It was driving me crazy for couple of hours! I hope Google will improve the UI of Firebase)
Make sure that the logged event name is longer than 40 characters, there is a limit for the length of the event name and parameter name.
https://support.google.com/firebase/answer/9237506?hl=en
Maybe it's not related to the question above, but I think it could help someone. Here's my case:
I was misunderstanding about when the user engagement update, I was thinking that it would be updated immediately after I've sent the event!
But it's not. You must to wait.
If you're wondering that, have you been successful sent the event to the board or not. You should check on the Debug-View section.
EDIT: DEAR PEOPLE FROM THE FUTURE, trey-jones has fixed this issue by implementing setLoginBehavior, FBSDKLoginNative seems to have issues on FB's end not with the module.
Environment:
MacOS X 10.10.5
Ti SDK 5.1.1.GA - 5.1.2.GA
iOS 9.2
Ti.Facebook 5.0.0 - 5.0.1
My project settings (tiapp.xml) are fine (it works on every other case on both iOS and Android).
Code I'm using to invoke the login:
var fb = require('facebook');
fb.initialize();
fb.authorize();
If the Facebook app is installed to the device the fb.authorize() doesn't open up. I did not see any iOS system level messages when this happened either.
Has anyone else had luck using fb.authorize with the new sdk on iOS devices WITH the app installed. With no fb app on the system it correctly opens the browser based view.
EDIT: I have managed a workaround for this (it is not pretty) based on the fact that login works with AppC's KitchenSink.
The workaround is to add a Ti.FB loginButton to the code, doesn't matter if its not visible, initializing this will fix whatever is causing custom login's .authorize() to not work.
//Workaround button:
if(OS_IOS){
var fbHaxBtn = fb.createLoginButton({
readPermissions: ['email'],
visible: false
});
}
//It needs to be added to the window/doesn't need to be visible though
$.login_window.add(fbHaxBtn);
//Then in our custom button's code, we can fire as normal:
function doLoginClick{
fb.initialize(); //I was having unexpected issues dropping this line on Android, although the docs say its deprecated.
fb.authorize();
}
Will keep this ticket updated if/when this thing gets a formal fix.
This is my second answer on this question. I believe that my original answer offers some value to the conversation and that is why I am leaving it, but it still did not consistently solve the problem of the facebook authorization not working.
The consistent solution turned out to be modifying the official Ti.Facebook module. I will submit a pull request for this change (1 line), but for now, you can get the working module here:
Source
Pre-built
This consistently allows users to authorize by explicitly setting the login behavior to use the browser, rather than the native facebook app through fast app-switching. This is actually the intent of Facebook's developers.
I was unable to determine what is causing it to fizzle when trying to use the native app to login - it should try the next option, which is the browser - but this works, and doesn't require a TiFacebookButton either.
I hope it helps someone else!
EDIT: This answer does not solve the original question. I have left it here in case it helps with related difficulties using the Ti.Facebook module. See my other answer, to actually solve the problem. END EDIT
I commented above, but after doing so encountered some more strange behavior, with the result being that I could not reliably use the workaround given (fbHaxButton). I want to explain what was happening in my case, and show my own workaround (which is also not pretty). It's possible that the root cause is the same for both of us.
I have not bothered with Android yet, so this answer is specific to iOS.
When I started this process, I came to the conclusion that authorize was correctly opening the facebook website in safari to allow authorization, but was not firing the login event upon returning. To handle this I had already implemented the following:
facebook = require('facebook');
Ti.App.addEventListener('resumed', function (e) {
var launchOptions = Ti.App.getArguments();
if(!launchOptions.url) {
return console.warn('Ignoring resume event with no url argument.');
}
// this lib = https://github.com/garycourt/uri-js
var URI = require('vendor/uri'),
uriComponents = URI.parse(launchOptions.url),
expectedScheme = 'fb',
expectedHost = 'authorize';
// I would like to be more specific about the uri, but we are limited
// in Titanium, and this will allow us to pretty certain
// that FB is sending us back to our app
if(uriComponents.scheme.search(expectedScheme) < 0 || uriComponents.host !== expectedHost) {
return console.warn('Resume event received, but scheme is incorrect. Ignoring.');
}
// synthesize login event
facebook.fireEvent('myapp:login', {
success: 1,
token: facebook.getAccessToken(),
uid: result.id
});
});
facebook.addEventListener('myapp:login', function onFacebookAuth(e) {
facebook.removeEventListener('myapp:login', onFacebookAuth);
if(!e.success) {
// do fail action
}
// do success action
});
facebook.initialize();
facebook.authorize();
So, originally I was firing and listening for an event called 'login', which the facebook module supposedly (according to the docs) will fire after authorization is complete.
In my case, this event was being fired while my app was in the background, after authorize was called, but before the user actually clicked 'OK' in facebook. My listener would respond to this event (logging, etc), but seemed to occur in a separate thread, or somehow otherwise become disconnected from my app, as it never passed its result along to the UI. I am using Q.js (kriw-kowal) and I belive this is where the disconnect is occuring.
Ceasing to listen to 'login', and simply handling my own synthesized event has fixed my issue.
I felt that this was very difficult to explain. If you have feedback about that, and how I can be more clear about what I believe is happening, or if you believe that I have reached wrong or incomplete conclusion, let me know - I'll try to update this answer to be better.
I have an turn-based game using GameKit in iOS. Generally, my authentication with Game Center works. My game works and I can for periods of time send moves back and forth. However, relatively frequently but not constantly, when I try to perform an action (e.g., finding a new match) over Game Center it fails with the error:
Error Domain=GKErrorDomain Code=6 "The requested operation could not be completed because local player has not been authenticated." UserInfo={NSLocalizedDescription=The requested operation could not be completed because local player has not been authenticated.}
Yet, the GKLocalPlayer.localPlayer().authenticated = true, both immediately before getting the error and after. After getting this error, the authentication viewController does not get presented and GameKit methods that rely on authentication cease to function (they don't come back to life ). Then, if I send the app to the background and then bring it back to the foreground, the error does not return when I retry the action (without requiring new login and password entry).
According to this similar observation:
GKLocalPlayer authentication not working, but isAuthenticated returns YES (Game Center sandbox)
"1.Game Center fails to complete authentication if your device has incorrect dates. So, go ahead and check the current date.
You might have done this. I trust you - iOS Simulator >> Reset Content and Settings"
I am getting this problem on the device, not the simulator, ruling out #2. Could someone help me with #1? I may be naive here, but my iPhone and iPad have the right time and date. Is there something or somewhere else I should be checking and setting?
Then, if this is not the issue, what else could be the problem? I am running iOS9.
I've seen this too, and have an open bug with Apple. In my case, I'm testing with multiple physical devices, and only one of those devices ever encounters this. On that particular device, I'm logged into iTunes using a personal account, but logged into game center using a test account.
From what I can see, when the device is using the same login for iTunes, iCloud and game Center, there are no problems. But, when I try to mix-and-match the accounts for whatever testing I need to do, then I randomly get error 6.
There doesn't seem to be anyway to recover from this, except to have the user re-login into game center. Of course, there's no way to present the login view controller again, so the only option is for the user to leave the game, kill it off, and star up again (which re-starts the game center authentication process). I trap the error now, give the user a message saying Game Center has logged them out, and explain what they need to do about it.
But as I said, when I stopped mixing up credentials on the device, the problem went away.
BTW, on a slightly related topic, I've come to view the .authenticated property as completely unreliable. It will be TRUE in conditions where you do not actually have connection to Game Center. I opened a bug on this, too. Apple closed it saying this was working as intended by using "cached" data. Thus, it will report authenticated when it's not authenticated and give you access only to outdated match and leaderboard data which had previously been saved locally.