Skip to content

Conversation

no-dap
Copy link
Member

@no-dap no-dap commented Nov 16, 2020

Based on Apple's JS support, Add activity with a web view to request authorization && get the result from callback API.

Authorization request will be fired by SignInWithApple.AuthorizeAndroid().

const { SignInWithApple, Device } = Plugins;

const info = await Device.getInfo();
switch (info.platform) {
  case 'ios':
    const appleUser = await SignInWithApple.Authorize();
    // ...
    break;
  case 'android':
    const androidUser = await SignInWithApple.AuthorizeAndroid({
      // Every implementation is same as Apple's JS support
      clientId: [ClientId],
      redirectURI: [RedirectURI],
      responseType: [ResponseType],
      scope: [Scope],
      responseMode: [ResponseMode],
    });
    // ...
    break;
}

Authorization result will be sent to callback API, so I add a javascript interface to handle it inside the web view.

Callback API can simply return a value to android via window.responseHandler, something like

<script>
    window.responseHandler.setResult('{your_result}');
    window.close();
</script>

@no-dap no-dap changed the title Feature/android support Add android support Nov 16, 2020
@no-dap
Copy link
Member Author

no-dap commented Nov 16, 2020

Back button handling added

@no-dap
Copy link
Member Author

no-dap commented Dec 22, 2020

TODO

  • documentation
  • modify the authorization method name

@no-dap no-dap mentioned this pull request Dec 22, 2020
@mesqueeb
Copy link
Contributor

mesqueeb commented Feb 4, 2021

@no-dap based on the latest version, this library now has native web support.

Could you update your PR so it's based on the web support that is now already built in?
Cheers!

@mirko77
Copy link

mirko77 commented Apr 21, 2021

@no-dap any updates? I see this PR has not been merged yet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants