is there a way to check if user is currently "signed in with apple" in flutter app? - flutter

I have a flutter app with 2 authentication methods:
Based on device id (associated with account during account creation)
Sign in with apple
I need to know whether user is currently signed in with apple on each app launch.
Why I need that:
When device id is not found in my back end, I send user to registration page, where user has 2 options to register:
regular registration
sign in with apple
The problem is that device id can be changed on ios upgrade, app reinstall etc. Therefore if user signed in with apple first time, but then his device id has changed, I want to remove sign in with apple button. Because for that particular case user is supposed to go through regular sign in method where he needs to enter phone number he entered during the registration and if he confirms SMS code, then account is linked to new device id and access is restored. I don't want them to click sign in with apple again, because during regular sign ins I only get tokens from apple and can't get apple id email anymore.
Hopefully that makes sense.
Thank you

Related

Login authentication like Netflix multiple users for same account in flutter

I'm creating an trading app in flutter
Imagine that if an user account has an multiple login from different mobile devices if any one the user can change the account password how can I logout from all other user of different device
Or plz instruct me to create an logine authentication like instagram if an user logged in from another device change a password it will automatically logout from other device
The way I see this is that Firebase doesn't allow you to implement this functionality right now so you'll have to get creative with this by :
Keep track of all the devices through name or IMEI from which logins of a particular user is happening
Create a boolean isSignedOutAll for each and every user and check for this at startup
Turn this to true if a user is clicking on Sign Out Of All Devices option
Logout the user if isSignedOutAll is true on a particular device and then change it back to false for that particular device
This is the solution that I can think of now.

App Store Rejection With Reason: your app requires users to register personal information to purchase non account-based in-app purchase products

For last few days this cat and mouse game is going on between me and App Store Reviewers. And despite searching everywhere, I have not been able to find an answer to this question, so seeking help here.
I have submitted an app with auto-renewable subscriptions in it.
My app requires that users sign-in in order to see additional options, which includes subscription option as well.
App Store Reviewers keep rejecting my app citing this same text every time:
Regarding 5.1.1, we continue to notice that your app requires users to register with personal information to purchase non account-based in-app purchase products, which does not comply with the App Store Review Guidelines.
To resolve this issue, it would be appropriate to make it clear to the user that registering will enable them to access the content from any of their iOS devices and provide them a way to register at any time, if they wish to later extend access to additional iOS devices.
We look forward to reviewing your resubmitted app.
Best regards,
App Store Review
What is non account-based in-app purchase products by the way?
I have also made it clear in my app what App Reviewer have asked above, i.e. make clear to the users that registering will enable them to access the content from any of their iOS devices. I didn't say iOS devices specifically, but said other devices since I'll have the same app on Android devices as well.
While I appreciate App Store Reviewers to help me improve my app, but I am totally lost here. I have submitted two updates to my app but every time it got rejected with the same reason.
Over this period I have also read their guidelines, read many similar cases online, but am still not clear what is required of me here.
Do they want the users to be able to purchase subscriptions even if they are not signed in? If so then technically how does this work? First it'll break the core functionality of the app since without registration I don't have user's info to create an account for them. Secondly how will I know which user purchased the subscription? I have to tie the subscription to the user's account on my backend. This means first I need to create an account for the user before user can purchase a subscription.
Please help me to get this right.
Currently I am waiting App Store's reply and my screens looks like these, with all other options removed when not signed in, and added text bottom of the Sign-In option, and help icon on top right of the screen where there is more information available for the user; and the one when user is signed-in.
If I would be a user of your app, I think I would find this behavior quite odd.
I would expect a login/registration screen when starting your app. If I decide to create an account, the Subscription button would always be visible within the settings.
However, there would also be an option "Continue without registration". If you do not create an account, the settings page could show some info text like "Some features are only available for registered members. Please tap here to create an account". Tapping the corresponding cell would show the registration page that is also shown when starting your app for the first time.
Maybe some users created an account in the past but forgot their passwort? Then they would not be able to restore their purchases, right?
Your login/registration form should also contain a "Forgot Password" option.
My app was eventually approved last year. The change I made was to remove the Subscriptions button from the Settings menu. And move it inside the user profile page. This means that user can see the Subscription option only after signing in and by going to their profile page. While this doesn't make sense to me, but that's how probably Apple wanted it. Subsequent updates to my app were also approved without any problem.

Apple Push Notification Registration & Device Token Receive clarification?

I am working on an iPhone app with Apple Push Notification integration. I have some doubts on this.
If the user clicked "Dont Allow" button in the APNS registration alert, will our code still receives the Device Token from APNS?
I have tested that when the user switched off the notification in iPhone notification, still the app receives the Device Token from APNS? It is correct?
Can anyone please clarify these doubts?
In my understanding on APNS, it doesn't depend on the user's action (as you mentioned that if when the user clicks on "Don't Allow" button) for your iOS to receive the Device Token.
If you included in your app:
- (void)application:didRegisterForRemoteNotificationsWithDeviceToken
This means that your iOS-based app is sending a request for Push Notification registration. In return, Apple sends the Device Token to the iOS; then the iOS sends the token to the app and then the app sends it to their service provider.
Note that when the user is asked "Don't Allow" doesn't mean that you're not going to receive the device token. "Don't Allow" refers to the action to be taken to any notification received by the app that is intended for the user. Say, location. This is a whole different thing. This means that the user doesn't allow the app to use his/her location.
Yes. it still receives the Device Token as what I have discussed in my answer to your question in #1.
This is only a setting for your app, which means that you won't be receiving any visible notification (badge, message or a sound) whenever there are updates about any information in relevance to your application. It's like setting your Facebook account to only receive notifications when your friends sends you a private message. Other than that, you won't be notified at all.
The process of enabling APNS is:
Request for certificate Authority
Create app id
Configuring AppId for Push Notifications
Create provisioning profile
Provisioning a device
Enabling the profile in Xcode
Creating push notification provider.
For more understanding on APNS, check this out.
I have tested with Xcode 6.1, ios8.1.2. Currently the device token will be generated only in two cases
Apple's default consent with "Ok" option
After "Dont allow", manual change in Setting->Notifications->app->AllowNotification(On)
By declining first time with apple's consent, will not generate device token, till manually change the value in settings page.

Expected sequence when using iTunes test user

I'm trying to test in app purchases in our app but I'm not having any luck. Part of the problem may be due to the expected sequence not being documented anywhere. Here are the steps I followed to support in-app purchases:
Create test user in iTunes Connect.
Log out of the Store on the device.
Build and run the app in Xcode using a non-wildcard App ID and provisioning profile targeting the device (an iPhone 4 running iOS 4.2.1). I've run through this building for both debug and ad-hoc release.
Make an in-app purchase.
Alert is displayed: "Confirm Your In AppPurchase" with two buttons - Cancel and Buy. Tap the Buy button.
Alert is displayed: "Sign In" with three buttons - Use Existing Apple ID, Create New Apple ID, and Cancel. Tap the Use Existing Apple ID button.
Alert is displayed: "Apple ID Password" with two text fields and two buttons - Cancel and OK. Enter the email address and password for the test user and tap the OK button.
Here is where my understanding of what is the expected behavior is deficient. Here is what I see at this point:
Alert is displayed: "This Apple ID has not yet been used in the iTunes Store. Tap Review to sign in" with two buttons - Cancel and Review. In all the documentation, blog posts, and forums, no one has mentioned this alert. Is this supposed to be displayed? I tapped the Review button.
I am now taken to the App Store app and taken through a series of steps to confirm the account.
The first page is titled "Confirm Your Country or Region" with a single value titled Store set to United States. I tapped the Next button on the toolbar at the bottom.
The second page is to agree to the terms and conditions and the Apple privacy policy. I tapped the Agree button on the toolbar at the bottom.
Alert is displayed: "I have read and agree to the iTunes Store Terms & Conditions." with two buttons - Cancel and Agree. I tapped Agree.
The third page is to confirm information for the account (email, password, security question, birth date) and enable/disable iTunes store subscription information. It requires me to enter the year (why didn't iTunes Connect just ask me for it!). I entered the birth year and then tapped the Next button on the toolbar at the bottom.
he fourth page asks is titled "Billing Information." This is when I realized something was wrong. All the documentation, blogs, and forums say I shouldn't be asked for a credit card.
Q1: What exactly should I expect once I enter the test user email address and password (the first set of steps)?
Q2: Why am I being asked for all this extra information for a test user? What should I be looking at to troubleshoot this?
Thanks for your help.
It happens when you install your development application over downloaded from App Store.
To fix this issue, you need to remove application from the device and install fresh copy using XCode.
iOS caches distribution profile somehow and requires production user if the first installation was done through App Store. With no regard what installation method was used recently.
Here is the trick (at least if worked for me..).
First log out of your real iTunes account in Settings > Store > Apple ID. You must be logged out of an account to be able to use your test account.
However, don't log in to your test account on that screen.
Go to the app, initiate your in-app purchase, and enter the test account email and password there. Assuming the test account is set up correctly (!), that should work.
Then, when finished testing, go back to Settings > Store > Apple ID and log out of the test account.
This sequence worked for me. I tried all of the above sequences and they failed for me.
Sign out of your account on the iPhone in Settings -> Store
Delete your test app
Power the iPhone off and on again
Close iTunes on your computer
Run the app again from XCode
Thanks to OmegaDelta's blog for this one:
http://omegadelta.net/2011/05/11/testing-in-app-purchases-in-ios-4-3-sandbox/
I found some answers to my questions above after I completely deleted the app off my device and tried again. I have no idea why that was required.
Q1: What exactly should I expect once I enter the test user email address and password( the first set of steps)?
No addition questions are asked once entering user credentials if it works, so if the first alert in the second list is displayed then you know it didn't work.
Q2: Why am I being asked for all this extra information for a test user? What should I be looking at to troubleshoot this?
The only thing I can think of is that there was something cached in my app from previous requests. This makes me nervous as I have no idea whether customers will have to delete the app or not like I did.
I've experienced the same problems until I quit iTunes and installed the right provisioning profile to my device. Running iTunes with Xcode restored my account from time to time so even when I log out on the device I was suggested to use my (not test) account in the app. Installing the correct profile fixed the second problem.
Hope it can help somebody too.
None of these answers is very specific or wholly correct, and the in-app behavior has changed slightly over the past year wrt test accounts. The true/current solution to this if you hit it: go through the review/sign-in pages in iTunes for the test account and just "cancel" from the "enter billing information" screen with no harm, no foul. If for whatever reason you never get prompted to review/sign-in, then don't bother to do so.
I was able to get around this issue by signing my test user into a different app that I was developing, then going back to the app where I was having problems (no amount of deleting or restarting helped). As others have said, you don't want to be signed in as the test user in the Settings menu when you try to perform your IAP.

iPhone Apple Push Notification service

When i log in to iPhone developer programmer portal as admin, if go to App Id section
i can see list of app id's.I want to enable for push notification.But in Action column there is nothing i am not getting configurable button. So i am not able to proceed further to get SSL certificate for my app.
In order to enable the Push Notification Service, you must set the explicit name for your App ID, not the wildcard asterisk character. See the iPhone Developer program user guide for more information.