Comments (4)
@jaredsinclair / @justin -- I'm willing to invest some time into making this happen, just want to get an idea from you for what would be a suitable solution. Looking through the code, OSKManagedAccountCredential seems to be the link between the keychain and the account identifier. If we could provide a delegate to this class and call if it exists & ignore it if it returns nil, other apps could provide their own keychain data in place of OSK's. Thoughts?
from overshare-kit.
You should be able to do this with the current API, if I understand your setup.
For users that have no accounts set up yet: You must do two things. First, provide an object for the OSKPresentationManager's viewControllerDelegate
. This object should override the following method:
- (UIViewController <OSKAuthenticationViewController> *)osk_authenticationViewControllerForActivity:(OSKActivity *)activity
Returning nil will fall back to the default OSK view controllers. For custom authentication of an OSKManagedAccount, create a view controller that conforms to the <OSKAuthenticationViewController>
protocol and return it from the above method.
For users that have already authenticated their account with your app, not using OSK: You can seed the OSKManagedAccountStore
with accounts on the user's behalf.
- Create an
OSKManagedAccountCredential
with the credentials your app already has stored. - Generate a unique identifier for the account to be created.
- Create an
OSKManagedAccount
with the credential and identifier from steps 1 and 2.
The methods you'll need to do this are:
OSKManagedAccountCredential
initWithBlahBlahCredentials:
OSKManagedAccount
+ (NSString *)generateNewOvershareAccountIdentifier;
- (instancetype)initWithOvershareAccountIdentifier:(NSString *)identifier
activityType:(NSString *)activityType
credential:(OSKManagedAccountCredential *)credential;
from overshare-kit.
Your custom authentication view controller should override the following method:
- (void)prepareAuthenticationViewForActivity:(OSKActivity <OSKActivity_ManagedAccounts> *)activity delegate:(id <OSKAuthenticationViewControllerDelegate>)delegate;
That method gives your view controller the opportunity it needs to prepare its interface for the given activity, and provides the delegate
object that it will notify of success/failure:
- (void)authenticationViewController:(UIViewController <OSKAuthenticationViewController> *)viewController
didAuthenticateNewAccount:(OSKManagedAccount *)account
withActivity:(OSKActivity <OSKActivity_ManagedAccounts>*)activity;
- (void)authenticationViewControllerDidCancel:(UIViewController <OSKAuthenticationViewController> *)viewController
withActivity:(OSKActivity <OSKActivity_ManagedAccounts> *)activity;
Any time after prepareAuthenticationViewForActivity:delegate:
is called, your view controller should walk the user through authenticating a new account. Your view controller is responsible to for notifying it's delegate
of cancellation. It's also responsible for passing a successfully authenticated account to it's delegate
.
from overshare-kit.
Awesome, thanks @jaredsinclair! I'm going to give this a shot and will report back.
from overshare-kit.
Related Issues (20)
- Update Instapaper icons for new version
- Network or authentication errors should be passed all the way up.
- Sorting activity
- Facebook audience button not localized.
- How can I add a custom activity?
- Implemented Sina Weibo and Tencent Weibo activities HOT 1
- Many instances of 'release' and 'retain' (pre-ARC) and other errors HOT 1
- MPMoviePlayerThumbnailImageKey GooglePlus error HOT 4
- Documentation regarding installation
- Email default appearance HOT 1
- Email Share Generates Service Termination Error on iOS 8 HOT 1
- Undefined symbols for architecture x86_64 - GooglePlus HOT 1
- Unable to submit apps due to GooglePlus framework causing validation errors HOT 3
- i think the "time" must be the "_authenticationTimeoutTimer"
- Existing FacebookSDK Integration
- How to setup my Facebook APP key?
- Is it possible to add Wechat and Weibo SDK?
- Sharing of Facebook Open Graph stories?
- Unable to simply use Facebook for sharing without a developer account set up?
- Facebook strings not all translated
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from overshare-kit.