Giter Site home page Giter Site logo

asauthcontrollerissuesample's Introduction

ASAuthControllerIssueSample

So, here's the issue:

If I have both email-password and apple id records in my keychain for an app, and want to request that data to do auto-login, I can get email-password based accounts info fine.

Apple ID does not work as expected though. I receive ASAuthorizationAppleIDCredential object with authorizationCode == nil. I do receive credential.identityToken and can decode the token. It's a valid one, but the thing is that I need authorizationCode.

If I use stand-alone login function of AppleAuthenticator, it works correctly. ASAuthorizationController executes performRequests perfectly and I can get authorizationCode from ASAuthorizationAppleIDCredential. The issue is with AggregatedAuthenticator. It seems that ASAuthorizationController is sort of broken and cannot get all the data if there's more than one request passed to it.

AggregatedAuthenticator(anchor: view.window!).startAutoLogin() // does not work with apple id

but

AppleAuthenticator(anchor: view.window!).login() // works

The only difference is that AppleAuthenticator uses only one request in ASAuthorizationController.

The only workaround that I could come up with is if I go to AggregatedAuthenticator and do the login again there, see the comment in code:

public func authorizationController(controller: ASAuthorizationController, didCompleteWithAuthorization authorization: ASAuthorization) {
    switch authorization.credential {
    case let appleIDCredential as ASAuthorizationAppleIDCredential:
        // Question: here we receive the credential without authorizationCode, but why?
        appleAuthenticator.login(with: appleIDCredential)
        // BUT if I do:
        // appleAuthenticator.login()
        // it works fine, but it shows that bottom sheet again asking for your face/touch-id again, but only for apple id this time
    case let emailPasswordPair as ASPasswordCredential:
        emailAuthenticator.login(with: emailPasswordPair)
    default:
        print("Irrelevant stuff")
    }
}

Any ideas, folks?

asauthcontrollerissuesample's People

Contributors

sergeypetrachkov avatar

Stargazers

 avatar

Watchers

 avatar  avatar

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.