Sign In with Email/Phone Number
Our iOS SDK offers the easiest way to verify email/phone numbers in your Swift app. You can simply call a function and it does most of the heavy lifting and authentication for you.
Last updated
Our iOS SDK offers the easiest way to verify email/phone numbers in your Swift app. You can simply call a function and it does most of the heavy lifting and authentication for you.
Last updated
Concepts: Learn about how Sign in with Email/Phone Number works.
Verifying email and phone number in your mobile app using our iOS SDK consists of the following steps:
Import Cotter
Call Cotter's Login function
Receive user's email or phone number, and whether or not it's verified
We use Cocoapods as our SDK host. If you're using Cocoapods, add this to your Podfile
Then simply run pod install
You will have to do import Cotter
on the file that will use Cotter. Then do initialization as follows
example:
example:
To login and enter email or phone number in Cotter's window, simply set the directLogin to false and set the input to empty string
To send code/link via SMS or WhatsApp, you'll need to add some balance to you project in the Dashboard.
The token will be received in the callback function. The token will be in the form as the following:
The token contains the user's phone number, your API_KEY_ID in the receiver field, and a signature to ensure this is from Cotter. The token tells you that this identifier is verified.
You should include this JSON Object into your call to your backend for Login or Registration. Your backend should then verify that the signature of the token is valid.
Checkout how to verify the OAuth Tokens from Cotter here:
Since you'll be using your API Key from a front-end website or mobile app, your API_KEY_ID
is exposed to anyone inspecting your code. Here are some ways to prevent abuse: