# Can anyone please tell me what is the correct way to add sign in with apple?

**URL:** <https://discuss.openedx.org/t/can-anyone-please-tell-me-what-is-the-correct-way-to-add-sign-in-with-apple/5917>\
**Category:** Site Operations Help\
**Created:** [October 8, 2021, 4:25pm UTC](https://discuss.openedx.org/t/can-anyone-please-tell-me-what-is-the-correct-way-to-add-sign-in-with-apple/5917 "2021-10-08T16:25:31Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![tomg10](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/tomg10/32/1928_2.png) [@tomg10](https://discuss.openedx.org/u/tomg10)\
**Post date:** [October 8, 2021, 4:25pm UTC](https://discuss.openedx.org/t/can-anyone-please-tell-me-what-is-the-correct-way-to-add-sign-in-with-apple/5917/1 "2021-10-08T16:25:31Z")

</div>

Hello Everyone

As you know apple now force every app to include sign in with apple id

I have tried to add sign in with apple to my website + ios app  
but i have a problem when I click the sign in with apple button  
I get this error

Invalid Client Id

I have checked the url  
and it is something like  
[https://appleid.apple.com/auth/authorize?client\_id=None](https://appleid.apple.com/auth/authorize?client_id=None)

even after I have added client id to the django admin but it is still None

Here how I did all

first I created an app in apple developer  
second I created a service ID for this app in apple developer  
and set the redirection url to ( [https://mywebsite/auth/complete/apple-id/](https://mywebsite/auth/complete/apple-id/))

finally I generated a private .p8 key from apple developer website

I copied the service id identifier as client id and private key admin as secret key to django

like this

Client ID:service identifier  
Client Secret:  
-----BEGIN PRIVATE KEY-----  
{ p8 key }  
-----END PRIVATE KEY-----

Can anyone please tell me what is the correct way to add sign in with apple?

---

<div class="post-metadata">

**Author:** ![Tim\_McCormack](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/tim_mccormack/32/9733_2.png) [@Tim\_McCormack](https://discuss.openedx.org/u/Tim_McCormack)\
**Post date:** [October 8, 2021, 7:22pm UTC](https://discuss.openedx.org/t/can-anyone-please-tell-me-what-is-the-correct-way-to-add-sign-in-with-apple/5917/2 "2021-10-08T19:22:08Z")

</div>

What version of edx-platform are you working with? I believe the apple-id social-auth backend is working in both koa and lilac.

I don’t think we have public documentation on how to do the setup. Theoretically, the configuration should be independent of Open edX, but I suppose there could be something particular to it.

---

<div class="post-metadata">

**Author:** ![tomg10](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/tomg10/32/1928_2.png) [@tomg10](https://discuss.openedx.org/u/tomg10)\
**Post date:** [October 8, 2021, 8:32pm UTC](https://discuss.openedx.org/t/can-anyone-please-tell-me-what-is-the-correct-way-to-add-sign-in-with-apple/5917/3 "2021-10-08T20:32:22Z")

</div>

Thanks

I’m using open EdX Koa

The problem is with the client id, it is not read from the Django admin and when I click the sign in button the client id it is set to None

can I add the client id on server without using Django admin if so which file should I change?

 ![Screenshot 2021-10-08 at 22.34.14](https://us1.discourse-cdn.com/flex020/uploads/openedx/original/2X/e/e6abac654013fe25fbfbba62e7ac79179f5ddf51.png)

---

<div class="post-metadata">

**Author:** ![Manish\_Hada](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/manish_hada/32/1651_2.png) [@Manish\_Hada](https://discuss.openedx.org/u/Manish_Hada)\
**Post date:** [October 11, 2021, 8:27am UTC](https://discuss.openedx.org/t/can-anyone-please-tell-me-what-is-the-correct-way-to-add-sign-in-with-apple/5917/4 "2021-10-11T08:27:45Z")

</div>

where are you setting up client ID and client secret in django settings? Please provide some more detail. there must be some configuration issue.

---

<div class="post-metadata">

**Author:** ![tomg10](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/tomg10/32/1928_2.png) [@tomg10](https://discuss.openedx.org/u/tomg10)\
**Post date:** [October 11, 2021, 2:43pm UTC](https://discuss.openedx.org/t/can-anyone-please-tell-me-what-is-the-correct-way-to-add-sign-in-with-apple/5917/5 "2021-10-11T14:43:46Z")

</div>

Thanks for your replay

I used the service ID as client ID from the apple Developer account  
and pasted it in  
[https://mysite.com/admin/third\_party\_auth/oauth2providerconfig/add](https://mysite.com/admin/third_party_auth/oauth2providerconfig/add)

like this

 ![appleid](https://us1.discourse-cdn.com/flex020/uploads/openedx/original/2X/9/9541d726f29ea4cf5bed8ba9f2b883f798374d83.png)

if everything is correct then I believe the problem must be within the apple id authentication file on the open EdX server ( I did not change anything)

---

<div class="post-metadata">

**Author:** ![Tim\_McCormack](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/tim_mccormack/32/9733_2.png) [@Tim\_McCormack](https://discuss.openedx.org/u/Tim_McCormack)\
**Post date:** [October 12, 2021, 11:19pm UTC](https://discuss.openedx.org/t/can-anyone-please-tell-me-what-is-the-correct-way-to-add-sign-in-with-apple/5917/6 "2021-10-12T23:19:37Z")

</div>

Here’s what I used when enabling the login for edX’s site:

- Select the `Enabled` checkbox
- Choose a `Name` value, e.g. `Apple`
- Choose a `Slug` value, e.g. `apple-id`
- Select the appropriate `Site`
- Leave `Visible` unchecked for now
- Set `Backend name` to `apple-id`
- Set `Client ID` to the client ID you got from the Apple site
- Set `Client Secret` to the contents of the key file that contains “BEGIN PRIVATE KEY”
- Set `Other settings` to JSON like this:

```auto
{
  "EMAIL_AS_USERNAME": true,
  "AUDIENCE": [" __your_app_id__", " __your_service_id__"],
  "CLIENT": " __your_service_id__",
  "TEAM": " __your_team_id__",
  "SCOPE": ["email","name"]
}

```

If I recall correctly, the `AUDIENCE` field should have only needed App ID, but we also had to add Service ID to make it work. I don’t recall why. Also bear in mind that we’re using a fork of the python social auth package’s apple-id code.

I _think_ I then used `https:// __LMS__ /auth/login/apple-id/` (has to match Slug setting) to initiate the flow during testing, before toggling the “Visible” checkbox.

If you could give this a try and report back either way, we can figure out where to document it – which might be on the Open edX side or the python-social-auth side.

Just be aware that Apple ID encourages users to select the “private email relay” option, which can cause problems during setup; for login or account recovery, they may be locked out until they realize they need to use the relay email address for login rather than their regular address. (I don’t think it would cause any trouble if they use their username, though.)

---

<div class="post-metadata">

**Author:** ![tomg10](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/tomg10/32/1928_2.png) [@tomg10](https://discuss.openedx.org/u/tomg10)\
**Post date:** [October 13, 2021, 6:22pm UTC](https://discuss.openedx.org/t/can-anyone-please-tell-me-what-is-the-correct-way-to-add-sign-in-with-apple/5917/7 "2021-10-13T18:22:27Z")

</div>

Thank You Very Much ,it solved the invalid client Id problem but now I get another problem the registration does complete , I checked the log file and I found this error:

[user None] [ip {ip}] [middleware.py:40] - Session value state missing.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex020/uploads/openedx/original/2X/e/e0015f89e879bc75925b71fd11133ab15fe98297.png) [@system](https://discuss.openedx.org/u/system)\
**Post date:** [January 11, 2022, 6:22pm UTC](https://discuss.openedx.org/t/can-anyone-please-tell-me-what-is-the-correct-way-to-add-sign-in-with-apple/5917/8 "2022-01-11T18:22:39Z")

</div>

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