# When setting up Apple Login, it succeeds in the local environment, but fails with Auth0 connections

**URL:** <https://community.auth0.com/t/when-setting-up-apple-login-it-succeeds-in-the-local-environment-but-fails-with-auth0-connections/115273>\
**Category:** Get Help\
**Tags:** other-built-in-social-connections, connections\
**Created:** [September 2, 2023, 11:33pm UTC](https://community.auth0.com/t/when-setting-up-apple-login-it-succeeds-in-the-local-environment-but-fails-with-auth0-connections/115273 "2023-09-02T23:33:06Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![masato](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/masato/32/46793_2.png) [@masato](https://community.auth0.com/u/masato)\
**Post date:** [September 2, 2023, 11:33pm UTC](https://community.auth0.com/t/when-setting-up-apple-login-it-succeeds-in-the-local-environment-but-fails-with-auth0-connections/115273/1 "2023-09-02T23:33:06Z")

</div>

I am currently configuring the Social Connections \> Apple settings. I have performed the configurations on Apple Developer and initially conducted a connection test in a local environment. (The PHP code below has successfully connected.)

Having confirmed the connection, I performed similar settings on Auth0, but an error occurs. (invalid\_request / the connection is not enabled)

Could it be that I’ve configured the wrong settings?

```auto
Local
------------
/Root
 ┣ index.php
 ┗ client_secret.php
 

▼index.php
  <?php
    session_start();
    $client_id = '【client_id】';
    $client_secret = shell_exec('php client_secret.php');
    $redirect_uri = 'https://【tenant-domain】.auth0.com/login/callback';
    $_SESSION['state'] = bin2hex(random_bytes(5));
    $authorize_url = 'https://appleid.apple.com/auth/authorize'.'?'.http_build_query([
      'response_type' => 'code',
      'response_mode' => 'form_post',
      'client_id' => $client_id,
      'redirect_uri' => $redirect_uri,
      'state' => $_SESSION['state'],
      'scope' => 'name email',
    ]);
    echo '<a href="'.$authorize_url.'">Sign In with Apple</a>';

▼client_secret.php
  <?php
    require '../vendor/autoload.php';
    use \Firebase\JWT\JWT;
    $teamId = '【teamId】';
    $keyId = '【keyId】';
    $sub = '【client_id】';
    $aud = 'https://appleid.apple.com';
    $iat = strtotime('now');
    $exp = strtotime('+60days');
    $keyContent = file_get_contents('../key.txt'); // ClientSecretSigningKey
    echo JWT::encode([
        'iss' => $teamId,
        'iat' => $iat,
        'exp' => $exp,
        'aud' => $aud,
        'sub' => $sub,
    ], $keyContent, 'ES256', $keyId);
  ?>

```

 ![auth0-apple-login](https://global.discourse-cdn.com/auth0/original/3X/3/1/31c5e47e9160916225be2f58ad34f9ba29d08f7c.jpeg)

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [September 6, 2023, 6:27pm UTC](https://community.auth0.com/t/when-setting-up-apple-login-it-succeeds-in-the-local-environment-but-fails-with-auth0-connections/115273/3 "2023-09-06T18:27:25Z")

</div>

Hi @masato,

Thanks for the question!

This error may indicate that the connection has not been enabled in your Auth0 Application Settings.

> **[Update Application Connections](https://auth0.com/docs/get-started/applications/update-application-connections)**
>
> Describes how to update an application's enabled connections using the Auth0 Dashboard.

Please let me know if that doesn’t solve it and we can dig deeper.

Hope this helps!

---

<div class="post-metadata">

**Author:** ![masato](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/masato/32/46793_2.png) [@masato](https://community.auth0.com/u/masato)\
**Post date:** [September 12, 2023, 11:31pm UTC](https://community.auth0.com/t/when-setting-up-apple-login-it-succeeds-in-the-local-environment-but-fails-with-auth0-connections/115273/4 "2023-09-12T23:31:00Z")

</div>

I can’t believe it! I thought the tests were independent!  
When I activated the application and tested it, it worked without any issues.

You’ve been a great help. Thank you, dan.woda. 😄

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [September 13, 2023, 1:18pm UTC](https://community.auth0.com/t/when-setting-up-apple-login-it-succeeds-in-the-local-environment-but-fails-with-auth0-connections/115273/5 "2023-09-13T13:18:31Z")

</div>

Glad I could be of service! Have a nice day!

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [September 27, 2023, 1:19pm UTC](https://community.auth0.com/t/when-setting-up-apple-login-it-succeeds-in-the-local-environment-but-fails-with-auth0-connections/115273/6 "2023-09-27T13:19:06Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
