Git Product home page Git Product logo

Comments (4)

dlo avatar dlo commented on September 12, 2024

@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.

jaredsinclair avatar jaredsinclair commented on September 12, 2024

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.

  1. Create an OSKManagedAccountCredential with the credentials your app already has stored.
  2. Generate a unique identifier for the account to be created.
  3. 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.

jaredsinclair avatar jaredsinclair commented on September 12, 2024

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.

dlo avatar dlo commented on September 12, 2024

Awesome, thanks @jaredsinclair! I'm going to give this a shot and will report back.

from overshare-kit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.