Assent v0.1.2 Assent.Strategy.Apple View Source

Apple Sign In OAuth 2.0 strategy.

You'll need to collect the 10-char long Team ID, the Services ID, the 10-char Key ID and download the private key from the portal. Save the private key to an accessible folder, or alternatively set :private_key with the content of the private key.


config = [
  team_id: "REPLACE_WITH_TEAM_ID",
  private_key_id: "REPLACE_WITH_PRIVATE_KEY_ID",
  private_key_path: "/path/to/key.p8"


You can use the JS SDK instead of handling it through auhorize_url/2. All you have to do is to set up you HTML page with the following way:

      <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]">
      <div id="appleid-signin" data-color="black" data-border="true" data-type="sign in"></div>
      <script type="text/javascript" src=""></script>

You can generate a state by calling:

{:ok, %{session_params: %{state: state}}} = Assent.Strategy.Apple.authorize_url(config)

See for more.