Skip to content
This repository has been archived by the owner on Sep 17, 2019. It is now read-only.

Integrate signinwithapplejs to add seamless support for Android #5

Open
SandroMachado opened this issue Jul 15, 2019 · 3 comments
Open

Comments

@SandroMachado
Copy link

Feature Request

Since React Native provides a seamless integration between Android and iOS, this library could also offer that experience. Apple released Sign In with Apple JS
to add support for non apple devices to use the apple-authentication feature.

Why it is needed

If the developer has an app for android and for iOS he need to provide the same authentication methods.

Possible implementation

We could try to load a webview to load the scripts.

<html>
    <head>
        <meta name="appleid-signin-client-id" content="[CLIENT_ID]">
        <meta name="appleid-signin-scope" content="[SCOPES]">
        <meta name="appleid-signin-redirect-uri" content="[REDIRECT_URI]">
        <meta name="appleid-signin-state" content="[STATE]">
    </head>
    <body>
        <div id="appleid-signin" data-color="black" data-border="true" data-type="sign in"></div>
        <script type="text/javascript" src="https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js"></script>
    </body>
</html>
@thib92
Copy link

thib92 commented Sep 3, 2019

This sounds like a good idea. However:

  • Apple provides a ready-to-use Sign In with Apple button that only works on iOS platforms. This would have a component equivalent on the JS side. So what should be displayed on the Android side? Nothing? Raise an error? A default opiniated alternative?
  • AFAIK, relying on a web-view means having a dependency on react-native-webview, which means linking it etc… is it something that is acceptable? Maybe this should be done in user-land

@victorloux
Copy link

@thib92 there is already a library for native Android that manages this (willowtreeapps/sign-in-with-apple-button-android). I've not used it, but the ideas seem like a useful base for how to implement it in React Native?
I personally don't think it would be unreasonable to have a dependency on other components if it is needed for Android only, since the primary reason people use React Native is to target both platforms with one codebase.

@thib92
Copy link

thib92 commented Sep 4, 2019

@victorloux definitely looks interesting!
This library basically mimics the Apple button, and then used a webview. If we want to have react-native-web support for this package, we’ll need to see if it’s possible to do both web and Android as a single code base, this could reduce implementation complexity.

Moreover, I know that Apple tried to make the JS lib as close to the native lib as possible, but we’d need to see what are the limits of this proximity!

Definitely needs some investigation :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants