ASWebAuthenticationSession autofill login/password

Hi, I want use ASWebAuthenticationSession to autofill login/password on a website. I tried some code but it doesn't work it always prompt me for password. First I goto webSITE from button click action and then get the permissions prompt;

https://pasteboard.co/IvzRXGZ.png

Then, after clicking continue button, the website prompts me for password;

https://pasteboard.co/IvzSJjs.png

I fill in my username and password.

Now, next time I go to page it SHOULD autofill with the login and password I entered. Its asking for login and password instead!


Here is code excerpt;

#import "ViewController.h"
#import <AuthenticationServices/AuthenticationServices.h>

@interface ViewController ()
@property (strong) ASWebAuthenticationSession *session;
@end

@implementation ViewController
@synthesize session;

- (void)viewDidLoad {
    [super viewDidLoad];
}

- (IBAction)loginBtnClicked:(id)sender {
    NSURL *destinationUrl = [NSURL URLWithString:@"https://site.name.edu"];
    NSString *callbackUrlScheme = @"https://site.name.edu/Pages/main.aspx"; // I don't know what to put here!!
    session = [[ASWebAuthenticationSession alloc] initWithURL:destinationUrl callbackURLScheme:callbackUrlScheme completionHandler:^(NSURL * _Nullable callbackURL, NSError * _Nullable error) {
        if (error != nil && error.code == 1){
            [self.session cancel]; // when 1 user wants to close Dialog?
        } else {
            printf("Error: %s", error.localizedDescription.UTF8String);
        }
    }];
    
    BOOL started = [session start];
    printf("Started? %s", started ? "TRUE":"FALSE");
}
@end

Under Capabilities I turned on;

  • Associated Domains — added “webcredentials:*.site.edu
  • AutoFill Credential Provider
  • Keychain Sharing — added “edu.name.AULoginTEst


But nothing ever gets saved.


Can any one help me resolve this?


Thanks!

  • Keep alive. I'm interested in an answer as well.

Add a Comment

Replies

Seems you have a duplicate post. Please, remove one of them.