Native Social Authentication
Lock by default handles all social authentication with Safari (Web Login), but you can enable native login for some social connections. Currently we only provide integration with Facebook, Google & Twitter that can be included like this in your
pod 'Lock-Facebook' pod 'Lock-Twitter' pod 'Lock-Google'
Lock uses Facebook iOS SDK to obtain user's Access Token so you'll need to configure it using your Facebook App info:
First, add the following entries to the
Then register a custom URL Type with the format
fb<FacebookAppID>. For more information please check Facebook Getting Started Guide.
Here's an example of how the entries should look like in your
Finally, you need to register
A0FacebookAuthenticator with your instance of
A0Lock *lock = ...//Get your Lock instance A0FacebookAuthenticator *facebook = [A0FacebookAuthenticator newAuthenticationWithDefaultPermissions]; [lock registerAuthenticators:@[facebook]];
Twitter authentication is done using Reverse Auth in order to obtain a valid access_token that can be sent to Auth0 Server and validate the user. By default we use iOS Twitter Integration but we support OAuth Web Flow (with Safari) as a fallback mechanism in case a user has no accounts configured in his/her Apple Device.
To support Twitter authentication you need to register
A0TwitterAuthenticator with your instance of
A0Lock *lock = ...//Get your Lock instance NSString *twitterApiKey = ... //Remember to obfuscate your api key NSString *twitterApiSecret = ... //Remember to obfuscate your api secret A0TwitterAuthenticator *twitter = [A0TwitterAuthenticator newAuthenticatorWithKey:twitterApiKey andSecret:twitterApiSecret]; [lock registerAuthenticators:@[twitter]];
We recommend follwing this wizard instead and download the file
GoogleServices-Info.plist that is generated at the end.
Then add that file to your application's target and the last step is to register two custom URL for your application.
The first URL should have a scheme equal to your application Bundle Identifier, the other one should be your Google clientId reversed, so if your clientID is
CLIENTID.apps.googleusercontent.com the scheme will be
And finally with your Mobile clientID from Google, go to Social Connections, select Google and add the clientID to the field named
Allowed Mobile Client IDs