Painless Facebook & Twitter auth on iOS 6+
UNLICENSE License
Painless Facebook & Twitter auth on iOS 6+.
Look at the Sample App. Check out the Sample Video. Try to break it.
Use SAAccountStore
. Request an arbitrary account by calling -requestAccountTyped:withOptions:completion:
. For more information, check out the sample app — this is the representative portion:
ACAccountType *accountType = [self.accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierTwitter];
[self.accountStore requestAccountTyped:accountType withOptions:nil completion:^(BOOL didFinish, ACAccount *account, NSError *error) {
if (account) {
// use it!
}
}];
If you need to process additional information on your backend service, you’ll want to get oAuth credentials. As long as your application is sharing the same set of client identifiers (“secrets”, huh) with your backend service, you can reuse the credentials.
To retrieve these credentials, SocialAuth invokes Twitter’s Reverse Auth or parses Facebook’s oAuth 2.0 Query Parameter. The application should implement credential retrieval right within the completion block of -requestAccountTyped:withOptions:completion:
.
Before you retrieve the credentials, you can optionally call -renewCredentialsForAccount:completion:
to renew the credentials if you know it’s a Facebook account. SocialAuth exposes -retrieveCredentialsForAccount:withOptions:completion:
which will retrieve the underlying oAuth credentials and funnel them back to you.
Access State | No Accounts | One Account | Many Accounts |
---|---|---|---|
Never Granted or Denied | Bails on Settings | Asks for Permission | Asks for Permission |
Explicitly Granted | Bails on Settings | Succeeds with Account | Presents Picker |
Explicitly Denied | Propagates Error | Propagates Error | Propagates Error |
UIActionSheet
that can be used to select an appropriate account. Once the action sheet finishes, SocialAuth invokes the callback with either the selected account or nil
if the customer has hit Cancel.NSError
object presented thru ACAccountStore
.This is free and unencumbered software released into the public domain. A copy of the license is attached in the repository.