Keeping XHR requests going when iOS put in the background - ios

I'm writing an app that uses https://github.com/AzureAD/azure-activedirectory-library-for-cordova to authenticate with Azure AD. It opens an embedded browser within the app that shows our Azure AD page and the user enters their credentials. Because we require multi factor authentication the system then sends them a push notification which if tapped* opens the Microsoft Authenticator app.
Using Safari's debug tools I can see that before switching over to Authenticator it is making repeated to requests https://login.microsoftonline.com/common/SAS/EndAuth, each time getting a response including "The authentication has not been completed yet, please try again." However once the Authenticator app is running (and my app is in the background) the requests pause and after approval is done I return to my app the last request that was made turns red (in the Safari inspector).
I believe I need to mark my app as being able to run in the background, but since the page that loses the connection is from AzureAD perhaps there is a setting or fix there that can restart the auth requests when the app returns to the front.
*If the user pulls down on the notification they are offered two buttons "approve" and "deny". My app is obscured by the notification but no other app has really taken focus. In this case when Approve is pressed the final request to ....EndAuth is successful, the app knows it is authenticated and everything proceeds.

Related

Basic Question: How to allow users in the same workspace to install my app?

I have a small app up and running for myself. It's an app homepage with buttons that shoot requests out to our hosted app, which returns modal payloads. It works perfectly for me.
When I began development I had to ask that the app be installed by our admin.
When other users in the same workspace attempt to install it they're greeted with "This is still a work in progress" instead of the app homepage.
I don't wish to distribute the app beyond my current workspace so I don't think I need to implement the o-auth flow. Any hints? I'm sure I'm missing something small.
The issue was that I was using a Home surface. To use app home surface you have to display it for each individual user, not a single time for the app, as I suspected.
When the user clicks on the app home page, it triggers an event that sends a payload to the URL you specify in the app's event subscription settings. You have to respond to slack api's /views.publish endpoint with a payload that defines the home appearance for that particular user. The user id is in the initial request payload.

iOS check user access token validity when app launches: best practice

I am currently developing an app which does have a user system. After user logins to the app, I will store user access token from the server and next time the app launches, the user will be auto logged in(or the login screen will be displayed if user is not logged, so the rootViewController will be set in applicaion didFinishLaunchingWithOptions).
So my question is what is the best practice for this? Currently what I have in mind is to set the root view controller to be some new controller(with in a spinner to indicate progress), and after the auto login(checking with server if the access token stored is still valid, if not valid, can be refreshed or not and stuff), I will manually set the rootViewController to be the correct one.
Someone also suggested me to hold the launch screen until the response from server is received.
thanks for your help.
Its may depends on the app security level. ie. Once the home page have no more secure details to display you don't have to hold at launch screen. but If you are developing a high secured app, Its must wait at launch screen until the responds is come from server for token check.

Facebook iOS SDK - open session and request read permissions

I'm using
(void)openWithBehavior:(FBSessionLoginBehavior)behavior completionHandler:(FBSessionStateHandler)handler
to open my session, which works fine. After open, I then get my read permissions with:
(void)requestNewReadPermissions:(NSArray*)readPermissions completionHandler:(FBSessionRequestPermissionResultHandler)handler
This works fine, but for users signing in through Mobile Safari (or likely the Facebook iOS app, haven't tested), users get jumped back and forth twice (tap login in my app, jump to Mobile Safari, log in there, jump back to my app, jump back to Mobile Safari, approve permissions, jump back to my app.
Returning users - those who have signed out of my app (and token removed), also get a double-jump - each time Mobile Safari tells the user they've already approved the app.
I'm using openWithBehavior because I prioritize the native iOS login using FBSessionLoginBehaviorUseSystemAccountIfPresent. I don't see a version of this combined with an initial permissions request (such as openActiveSessionWithReadPermissions...).
I was hoping that, for subsequent logins, permissions would already be known via session.permissions but in testing that value is null until requestNewReadPermissions is called.
Is it possible to remove the double-jump from either or both scenarios (first user login, subsequent user login) yet still achieve the same permissions?
You can "init" your session with read permissions by calling the initWithPermissions: method. Then call openWithBehavior:completionHandler: which will do only 1 open call with the permissions you've already set.

Can we get any result or feedback when launched a link in UIWebview within an ipad application

I developed an ipad app where in i have a situation where the user taps a button which redirects to a login page (UIWebView),The user enters his credentials and web page hits a server where the validation takes place and the browser is returned a feed back string (authorization).
Question:
Is there a provision to know the feedback string/data by the application? According to my knowledge as soon as a webView is launched our application has no info about the happenings on Webview.
I don't want to implement services in my application since the service provider says that the webpage redirects the user to app upon successful login.Which may be possible on a desktop,but in ipad application can the bowser/Webview redirect back to the application upon login and more ever i need the feedback string in my application.Can some one suggest how could i implement the same.Please correct me if i am going wrong...
TNQ
You can call Objective-C methods from UIWebView. This you can do by trapping your custom urls in the shouldStartLoadWithRequest: method. More details are here.

iOS not receiving user to user app requests

I am sending app requests from an iOS native app using Facebook SDK dialog. I have created a canvas app and set the iTunes ID (using a valid ID from a different app in the store now, since mine is not). The requests arrive at desktop www site, and show up under "App and Games>Invites from friends". But, they do not show up on iOS native Facebook app, unless I first do Facebook SSO with my app. Then, my app bookmark appears in FB, and new requests increment the counter.
How do I get the requests to show up on iOS before my app is installed? Other peculiar thing that may be related, is I get no activity under "Notifications" on iOS, only the app bookmark. On desktop, I see the Notifications globe flash with a red badge at first logon, but then the badge goes away and nothing is there, although the requests appear under "Apps and games". This seems not totally consistent as some people who have tested my app get the expected Notification behavior, but I never do on my own FB account. Could it be because if added and removed the app repeatedly for testing?
Any clues?
My problem seems to have been something fouled up in the Facebook database, probably as a result of my various misfires in early development. At some point it began working correctly without any changes on my end.

Resources