Sign-in with Apple from device using NextAuth.js - next-auth

When using the Apple provider with NextAuth.js on the web server and signing in on a native device app (written in Swift using ASAuthorizationAppleIDButton and ASAuthorizationAppleIDProvider) using Sign In With Apple, how do you add a new user and account to the NextAuth.js database tables?
Besides signing into the iOS app, the user also needs to be able to sign into a website with Sign In With Apple and link his user account to other OAuth providers like Google (e.g. if signing in on Android). This question focuses on just Sign In With Apple on an iOS device and how to record that account info so that it plays nicely with sign-ins on other platforms.
Does NextAuth.js have a REST API that the iOS device can call to do this? Otherwise, if custom code on the Next.js server is needed to add the rows manually, is there documentation on what goes into each of the columns in NextAuth.js user and account tables?

if you just setup the AppleProvider, NextAuth.js won't keep a database of your users.
It lets Apple handle that and then just gets a signed message back saying, im paraphrasing, "Yup, thats Edward, and here are some more details about him.." and includes some basic info like your email address, profile picture URL, etc.
This is the basics of their OAuth-only strategy.
If you'd like to persist user data yourself and maybe add additional fields to the ones Apple returns to you, you'll have to setup an adapter. An adapter in NextAuth.js world is just a database where it will automatically save any new users and check against for existing users.
You can see the details of the various available adapters, including the default model/schema here: https://next-auth.js.org/adapters/models

Related

Implementing stripe connect directly from within an iOS app

There is a post re: implementing stripe connect from a couple of years ago.
How to use Stripe Connect in an iOS app
I have built an app where only User A needs to register and login while User B can choose from a list of User As and i am trying to set up the app so User B can pay directly to a User A.
While the basic version of stripe is relatively easy to implement Stripe connect is giving me a bit of grief.
Specifically there is an example called Rocket Rider on github (which is meant to.mimic uber, etc.) made by stripe but in this example the "Pilot" had to register via a website.
I'd like it all to happen from within my app. I've read the docs a few.times now and still a touch uncertain.
Is the post from a few years ago still relevant? Is the only way to have the registration done via the app to use a webview?
In the stripe docs there is a section https://stripe.com/docs/mobile/ios/standard
Which essentially goes through the implementation for iOS. But I wasn't sure if these docs only refer to payment that as the developer I would receive if say I was selling a product to users.
Again, in my app there is a list of User As and each User A would register ideally within the app and then User B can choose who to pay. I wasn't sure if the "Standard" doc above also refers to this scenario.
Thanks
Been looking into the same thing today (March 2019) and have a few answers for you
The current state of the Stripe Cocoa Pod does not have anything that has to do with connect accounts. That will not help you in any way with creating connect accounts.
All is not lost. If you must stay in-app, you may create what is called a Custom Account--This means that you are responsible for the UI, User Validation, and Communication. Your users will not be able to use the Lovely Express Dashboard either....but you can stay in app.
As you alluded to, you are still able to use Safari to open Stripe Express and have your app handle the deep linking once the experience is complete. While this is an annoyance, there are some serious perks to having the Express experience. You don't have to deal anything bank account related because the Express Dashboard will handle it for you and Stripe will handle all verification communication. (Outside app).
TLDR: You can do it completely in app using Custom Accounts......but you'll be on your own!

App Rejected on 17.2 clause. Asking for email ID

My app is a sync solution (imagine dropbox).
The user needs to sign in to access the app's features, and if he does not have any account already created, he can sign up.
The sign up asks for email id verification, and this email id is also used if the user has forgotten his password to send him one.
but Apple has rejected this app saying:
17.2: Apps that require users to share personal information, such as email address and date of birth, in order to function will be rejected
We found that your app requires customers to register with personal information to access non-account-based features, which is not in compliance with the App Store Review Guidelines.
Apps cannot require user registration prior to allowing access to app features and content that are not associated specifically to the user. User registration that requires the sharing of personal information must be optional or tied to account-specific functionality. Additionally, the requested information must be relevant to the features.
Although guideline 11.6 of the App Store Review Guidelines requires an application to make subscription content available to all the iOS devices owned by a single user, it is not appropriate to force user registration to meet this requirement; such user registration must be made optional.
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 to provide them a way to register at any time, if they wish to later extend access to additional iOS devices
Please help me solve this. Many apps like dropbox/facebook require login.
I don't get the exact reason why they rejected my app.
Also, please guide about the in app purchase, why registering cannot be mandatory
Asked App Store Review people for clarification on their rejection.
They accepted it. and the app got approved :D
Its on Appstore now :)
I also Faced this kind of Problem and my app also Rejected due to this.And Again I Changed my App flow Like User Registration will be Optional. User can See all the Feature of the app with out Registration by skipping this step.If he want to do something user-specific then you can ask to register such as : (user like,comment,photo upload etc) or else he can use the contents and features which are public.
in Case of in-app Purchase You can Prompt user that if He will Register with your app he can able to use this Content in his all devices.
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 to provide them a way to register at any time, if they wish to later extend access to additional iOS devices
Apple does not allow apps that require you to share person information to work, like an e-mail address.
You options are, remove the need for an e-mail address or remove account creation form you app and move it to a website.
It also states that you app is asking to create an account to access the full app and even needs the account or acces features that do not require the user to have an account. You can make those features available with out the account creating you might be able to get thru the review.
The reason apps like Facebook and Dropbox got thru the review proces is because they don't have a register option which is in app only. They redirect to a website.
I recently spoke to an Apple Rep over the phone in regards to an app of mine that was also accused of violating clause 17.2.
I explained to him that the email would be used for password recovery, monitoring transactions within the marketplace, and managing any inappropriate behavior (such as users uploading offensive or copyrighted content). The rep responded, "Sir, the clause states 'Apps that require users to share personal information, such as email address and date of birth, in order to function will be rejected'. I cannot allow you to require your users to submit their emails if its not account-based". He did not seem to understand that the emails are account-based for the very sole purpose of security.
I did mention to him that Instagram and Facebook alike require logins at startup. He simply replied, "Yes but those apps are entirely account-based."
Honestly, I felt he was blindly following Apple's Guidelines ("Because that's what it says we must strictly follow!"). He had little understanding of how social networking apps operate, and even less understanding of the law (specifically the DMCA - on a separate issue). Explaining to them how all that works proves to be futile; they wont budge because they are asked to follow Apple's BROAD Clauses as strictly as they do.
My conclusion: I had to compromise the app's user flow such that the app's registration page can be skipped, and all other functions within its marketplace were locked to non-registered users. It makes no sense.
The sign up asks for email id verification, and this email id is also used if the user has forgotten his password to send him one.
Apps cannot require user registration prior to allowing access to app features and content that are not associated specifically to the user.
It seems to me that the point is that you are asking the user to provide his email address as a step towards the creation of a user account. This is different from what dropbox and other apps do (i.e, you provide your credentials for your dropbox account, which is different from your email address, although it can be the same).
You may either remove altogether email verification, or you could postpone it to a later point when you have made clear to the user that this is required to access private information.
I got the same thing last week and this is Apple's reply:
As for the 17.2 issue, a nickname, avatar, or sharing are not inherent or specific features of those social networks, and thus, the user should not be required to register with those services, or provide you with access to their social network accounts. The user should not be prevented from using your app and service if they do not provide this information.
Instead, it would be appropriate use your own authentication method and give users the option to create a nickname and upload an avatar, independent from those networks.
Moreover, we realize that these social networks may be very popular. However, the popularity of the social network is not an appropriate reason to force a user who has not, or chose not to register and provide their personal information to those services, before they can use your app.
Therefore, we ask that you to include your own authentication mechanism to allow the user the option to register only with you, creating an account with only the information needed and relevant to your app's features.
Best regards,
App Store Review
So in short, you have to provide custom authentication and not just use Facebook. Although I've seen many Apps who do require you to login with Facebook.
Thanks,
James
It happened same for me, although the first version was approved, the second version was rejected for this reason, I added the Skip button at the landing view.
It's all summarized in the last paragraph. Apparently, your application doesn't inform the user (in a clear way) that registering is for syncing and from their reply, it seems that your application is useless without the Sign Up.
If that's the case, you should be more specific why you need the user to register.
On a side note, I personally don't like the applications/websites that force you to register before you see or try anything. I hope your application isn't the same.

How can I submit a login-required app to the AppStore when I can't provide an account for test?

I know that an account for full access of all features is required when submit an app for review.
Users of my app are in fact university teachers and students. Actually this app is just a third party one which I developed for iPhone users, for the reason that the original and official website of my university runs pretty bad and sometimes even fails on Safari. Obviously I don't have the access to the database to create a test account.
In addition, the auth server is only open for users inside my university (the IP address of the server is a virtual one for local network.) Even though I provide them with my own account, they will still not be able to login.
You can't. Apple will not review a login-required app if they can't log in to it.
Build a test server that interacts with the app exactly the same as the real client server except for being visible outside your clients secure network (and containing only a dummy data set, no actual private or proprietary data), create test accounts on that, test your app against that, then submit the app to Apple with a working test account on the test server.

iPhone in app purchase subscription to web server data. How should I auth?

I'm working on an app that will provide data from a web server to users but only if they've bought an in app purchase subscription. I understand the basics of IAPs but how do I securely make sure the data from the server is only accessible to the app, and only if the subscription has been purchased? I don't want to make the user set up an account, I just want to auth the app/purchase securely.
Thanks in advance :)
I'm going to use subscription model too with IAP.
AFAIK, you SHOULD NOT use a unique phone identifier like the IMEI of the phone to identify the user on your server. According to the Apple documentation, you MUST provide a way so that an user can restore his subscriptions on several devices!
Besides, a call to restoreCompletedTransactions of the SKPaymentQueue will restore ONLY nonconsumable products! Subscriptions are not supported by this method.
See these links :
http://developer.apple.com/library/ios/#technotes/tn2009/tn2259.html (section « Frequently Asked Questions », point 10)
iPhone - How to recognize the iTunes user of my app
The only way I know is to use a login/password to identify the user on the web server but this could be quite ugly...
However, if someone know another way, could he describe his solution ?
You should upload store receipts to your server, to be able to check them on Apple's site. And, with request you should upload phone identifier. And, of course, store somewhere in the database. After all, you will have information about which phone id has access to subscription.
And, when you will request subscription-related info from your server, you'll be able to check who has acces (via phone id) and who hasn't.

Does my client need a developer account to submit the app I made them to the App Store?

I wonder if someone could offer insight here:
I work for an independent multimedia firm who builds communications material for their clients. We're currently working through our first iPhone app. So, my shop has now completed an app that conforms to our client's brand, and we wish to deploy this app to the App Store on behalf of our client. Looking over Apple's documentation, everything seems to be written on the assumption that you are releasing your own app... therefore, the Apple documentation seems to start one step ahead of where I need it to.
So, as a multimedia production firm, I have set up a developer account for my company that I have been using to develop our client's app. However, I assume my account cannot release my client's application, given that it would cite my company's name as the publisher. Therefore, how do I start this process on behalf of my client? Will they first need their own $99 developer account to publish with, or is there a separate publisher identity that I can set up within my account that represents my client?
Any and all help on this would be appreciated. Thanks!
I typically have the client create their own account. From there most clients will provide me access to their admin account so I can go through the rest of the steps.
I often submit apps through their admin account, however, a team member is an option if the client is not interested to provide admin credentials.