How to check the data authorization status in iOS10 - ios10

When App launches on an iOS10 device for first time, alert will show and say "Allow 'XXX' to use data". I really wonder how to check the data authorization status and how to request the authorization manually.

Related

How does firebase cloud messaging map an FCM token to an APNs token

I'm trying to get my head around how FCM actually works in Flutter. What's strange to me is that you can call:
FirebaseMessaging.instance.getToken();
and retrieve a token, even before the user has authorised the app for notifications. What's confusing to me is that:
I don't see anywhere where the FCM token is actually being uploaded to my FCM instance.
Once the user has authorised the app for notifications, how is the APNS token that is generated on acceptance actually linked/mapped to the one already in the FCM instance?
Furthermore, I always get the warning:
APNS device token not set before retrieving FCM Token for Sender ID '123412341234'. Notifications to this FCM Token will not be delivered over APNS.Be sure to re-retrieve the FCM token once the APNS device token is set.
But I can't see how to set the APNS token, or re-retrieve the token once the APNS token is set. Notifications are working on a real iOS device, so I don't see why i'm getting this message.
The docs are a little thin on the actual explanation of how FCM is communicating with an app instance in order to stay in sync with it. Can anyone help me understand this a bit better?

Huawei Subscription Validation ResponseCode:6 ResponseMessage:Token is expired or invalid InappPurchaseData

I'm trying to verify subscription purchase in our backend servers, considering from this hms-iap-serverdemo GitHub repo.
I'm trying to connect OAuth 2.0-based authentication servers using app ID and app secret. I took ID and secret from AppGallery Connect → my app → app information. The auth servers returns base64 encoded token. When I try to verify with this subscription purchase, I am getting ResponseCode:6 ResponseMessage:Token is expired or invalid InappPurchaseData error from server.
The status of the application is currently draft. Is that why I'm getting this error? I believe client ID and client secret is correct. Or something else. I do not know. Do you have an idea?
Thank you
ResponseCode:6 ResponseMessage:Token is expired or invalid InappPurchaseData
The possible causes are as follows:
Check whether the token is invalid.The token validity period is 1 hour. If the token expires, obtain a new token to ensure that the token is valid.
Check whether the AT is invalid and whether only the AT in the cache is obtained. If the AT is invalid, clear the cache and obtain the AT again. Generally, use the token interface to obtain the application-level AT again.
For details about how to obtain the application level AT, see docs.
The token format is incorrect.
According to the docs:
App-level access token: Authorization: Basic Base64(APPAT:atvalue)
Example: The app-level access token is thisIsAppAtValue, then APPAT:atvalue is APPAT:thisIsAppAtValue.
Therefore, replace APPAT:atvalue in Base64(APPAT:atvalue) with "APPAT:thisIsAppAtValue" to generate value QVBQQVQ6dGhpc0lzQXBwQXRWYWx1ZQ==.
The value of Authorization in the request header is as follows: Basic QVBQQVQ6dGhpc0lzQXBwQXRWYWx1ZQ==
The site request is incorrect.
Switch to a proper site based on your location and try again.
China: https://subscr-drcn.iap.hicloud.com
Germany: https://subscr-dre.iap.hicloud.com
Singapore: https://subscr-dra.iap.hicloud.com
Russia: https://subscr-drru.iap.hicloud.com

How to properly use refresh token on different devices?

After successful authorization on the client, two tokens are saved in cookies, one of them is access the other is refresh, when the access token expires, the client sends a refresh and the server issues two new tokens to the client, the point is, the fact is that if the user logs in from another device, for example, from a phone , then the refresh token on the first device will already be invalid. Refresh token is stored in the database table users, in the table fields: email, password, refresh_token.
That is, when authorizing on another device, the refresh_token field will be updated and on the first device, the refresh token is already invalid in the cookies. How to make it possible to use the refresh token, not only on one device? I saw that I needed to do something with the device identifier, but did not understand, I also did not understand where to get this device identifier. I would be grateful if you describe in detail how to properly organize this process.

Unexpected Authorization Request in Workflow C2QB WF3.0

We have a multi-tenanted/multi-domain app and we're looking at publishing on IPP. Because of the multi-domain nature our configured endpoints in the App setup are generic and users are then redirected to their specific account once their identity is established.
The issue is with C2QB WF3.0.
The test steps are:
go here: https://appcenter.intuit.com/Home/MyApps/
on the "Launch My Apps" tab, click the app
Expected Result:
the Sign In screen for the app is displayed
The requirement is:
if not still signed into the app, sign in screen is displayed
if still signed into the app, take user into the app
The issue is that the even if the user is currently logged into our application, it still requests authorization as per this message:
"domain" is requesting some information from your Intuit account
By approving this request "domain" will be able to access your:
Name
Email Address
The workflow that it is actually following is to perform a callback to our connect url. The normal way to determine which account the callback is coming from is via the realmId, but this is not received from Intuit and therefore it needs to be requested. Once a user has completed this authorization, it will not ask again. It should be noted that we're not actually requesting a name or an email address as the screen suggests.
We've been informed by Intuit that it should not request authorization and it is not part of the workflow.
We're wondering if anyone else has encountered this problem and if there is a workaround for it.
We discussed with the Engineering teams and they confirmed what Pete has mentioned above. This is not a bug and please follow the steps as Pete has mentioned.
If you want to replicate the 'access your app with appcenter flow', you have be either logged in QBO online company file in same browser session or navigate to the app via blue dot menu from your application or run your application from localhost(.net) and then go to Appcenter and login there on same tab and then click on your app.
Since your desktop application is running, your code will be hit.
You will then get the second Auth screen only for authorizing your company file. After authorization your realm will be set in a cookie and in the code you can see its value. You can replicate this behavior via firebug and see the qbn.parentid cookie value has the realm after authorization is done.

How and where to perform login process (in this case getting token from server) in iPhone app?

So what I need to do in my application for loggin in is Perform an HTML request with user/pass which returns XML with a token. The token is used in later http requests.
I know how to perform http requests and also how to parse them, I have already been doing that just with the token hardcoded for testing purposes. I also have it worked out how to use the Application Preferences to allow entry and retreval of the password via:
NSString* settingValue = [[NSUserDefaults standardUserDefaults] stringForKey:#"<Setting Key>"]
The question is if I want this to happen when the application launches where shall I do this? I don't want my application to hang when it launches without giving some feedback to the user, you know if there is no user/pass set or if its rejected by the server. What is your advice? Thanks
In the app that I am developing, I do it in the first view in a separate thread. This way it doesn't lock the UI. I also do it as a delegate of the main view so it can report back the progress for a progress bar. Later on I'll will be doing it as a slide in view thats just shaded so the person can use parts of the app that don't require auth while the auth is loading.
IMO if you do it in the app delegate it might take several seconds for you to auth and you will not be able to report this to the user easily.
The best way to deal with authentication is using cookies as you are using HTML requests. You can retrieve these cookies using NSHTTPCookieStorage app wide (not just in the class that did the authentication). If you want to continue using your token you can create a global variable in your Application Delegate class (myApplicationAppDelegate.h)
P.S, I wouldn't keep the username and password in NSUserDefaults as its stored in plain text on the device. Use keychain instead.