Skip to content

Commit 34df5d6

Browse files
committed
Remove apple instructions, add link
1 parent b178eef commit 34df5d6

File tree

1 file changed

+1
-90
lines changed

1 file changed

+1
-90
lines changed

README.md

Lines changed: 1 addition & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -35,95 +35,6 @@ Additionally, because `RWJS_API_URL` is used by the web-side code, you'll need t
3535
### Enabling OAuth Provider(s)
3636
After setting up both sides, you'll need to enable your chosen OAuth provider(s). Currently supported providers include:
3737

38-
[Apple]()
38+
[Apple](https://github.com/spoonjoy/redwoodjs-dbauth-oauth/wiki/Enabling-Apple-as-an-OAuth-provider)
3939
[GitHub]()
4040
[Google]()
41-
42-
#### Enabling Apple as an OAuth provider
43-
The first thing to know about Apple is that *they don't allow you to use Sign In with Apple on localhost, and require SSL*.
44-
Therefore, if you want to test this locally, you'll need to [alias your localhost URL](https://www.tothenew.com/blog/aliasing-localhost-url-in-mac-os/), and then [create an HTTPS cert for that domain](https://gist.github.com/cecilemuller/9492b848eb8fe46d462abeb26656c4f8). You can then configure your front end server to use this cert, and update your `redwood.toml`'s `host` parameter to your alias. If there is enough demand for a proper guide on doing this, I'll write something up - let me know :)
45-
46-
For Apple, we need to collect the following four environment variables:
47-
- `APPLE_TEAM_ID`
48-
- `APPLE_CLIENT_ID`
49-
- `APPLE_KEY_ID`
50-
- `APPLE_PRIVATE_KEY`
51-
52-
We'll also need to add all of the redirect URIs that we'll be using - Apple requires that none of these contain `localhost` and that they're explicit - you cannot give it `https://myapp.com` and then use `https://myapp.com/method`.
53-
54-
Let's get started!
55-
56-
##### Prerequisites
57-
1. Sign up for an Apple developer account.
58-
2. Sign in to the Apple Developer portal.
59-
60-
Then...
61-
##### Getting `APPLE_TEAM_ID`
62-
1. From the sidebar, click on **Certificates, Identifiers and Profiles**.
63-
2. Click **Identifiers**, and in the dropdown on the top right corner, make sure **App IDs** is selected. Then, click the **blue plus icon**, and select the **App IDs** option.
64-
3. Select the type **App**, and click **Continue**. Then, fill in a **description** ("My Redwood app", etc.) and **bundle ID** ("com.myapp", etc.)
65-
4. From the list of capabilities, make sure **Sign In with Apple** is checked. Hit **continue** to be taken to the confirmation screen.
66-
5. On the confirmation screen, you'll see your `App ID prefix` - **this is your `APPLE_TEAM_ID`**.
67-
68-
##### Getting `APPLE_CLIENT_ID`
69-
1. From the sidebar, click on **Certificates, Identifiers and Profiles**.
70-
2. Click **Identifiers**, and in the dropdown on the top right corner, make sure **Services IDs** is selected. Then, click the **blue plus icon**, and select the **Services IDs** option.
71-
3. Fill in a **description** ("My Redwood app service", etc.) and **Identifier** ("com.myapp.client", etc.). **This identifier is your `APPLE_CLIENT_ID`**.
72-
4. Hit **continue** to create your new Services ID.
73-
74-
##### Getting `APPLE_KEY_ID`
75-
1. From the sidebar, click on **Certificates, Identifiers and Profiles**.
76-
2. Choose **Keys**, and click the **blue plus icon**. Give your key a name ("Key for my Redwood app", etc.), and make sure **Sign In with Apple** is checked.
77-
3. Click **Configure**, and then in the **Primary App ID** dropdown, select the App ID that we created above when we were getting the `APPLE_TEAM_ID`. Hit **Save**.
78-
4. Hit **Continue** to proceed to the confirmation page. Verify once again that **Sign In with Apple** is checked, and click **Register**.
79-
5. You'll be taken to a page to **Download Your Key**. **Download the key**, and note the **Key ID - this is your `APPLE_KEY_ID`**.
80-
81-
##### Getting `APPLE_PRIVATE_KEY`
82-
1. In the previous step, you downloaded your private key. Open it in TextEdit, or the text editor of your choice. **The contents of this file are your `APPLE_PRIVATE_KEY`**.
83-
84-
##### Adding Website URLs
85-
1. Go back to the service you created above (at [this link](https://developer.apple.com/account/resources/identifiers/serviceId)).
86-
2. Hit **Configure** next to **Sign In with Apple**. Click the **blue plus icon** next to **Website URLs**, and add the following:
87-
- Under **Domains and Subdomains**, enter your website's domain name ("myapp.com", etc.).
88-
- Under **Return URLs**, add the following, filling in your API URL so that these are complete URLs:
89-
- {your API url}/auth/oauth?method=signupWithApple
90-
- {your API url}/auth/oauth?method=loginWithApple
91-
- {your API url}/auth/oauth?method=linkAppleAccount
92-
93-
##### Using the Apple environment variables
94-
Go ahead and add the four environment variables that you just collected to your environment. You'll do this in your `.env` file while working locally, and in your deployment settings for your hosting provider in production.
95-
96-
*Make sure* that you paste the `APPLE_PRIVATE_KEY` exactly as it is in that file, line breaks and everything. For example, in your `.env`, it'll look something like this:
97-
```bash
98-
APPLE_PRIVATE_KEY='-----BEGIN PRIVATE KEY-----
99-
asdhfjkalsdfhkalsdfhrwipqfhsjakldfhaskldfhasjkldfhasjkldhf
100-
asdjfals;kdfjasl;dfjalks;dfjal;sdfkjrufwqohfsjdklfhask
101-
asfjhksdafhaslkdfhasjlkdhfaslkdjhfakjsdlhfajlksdjhflaksdjhf
102-
asdfjalsdj
103-
-----END PRIVATE KEY-----'
104-
```
105-
106-
You'll also need to update `redwood.toml`'s `includeEnvironmentVariables` parameter to include your `APPLE_CLIENT_ID`, otherwise it won't be available to your client, and your client won't be able to kick off the OAuth flow.
107-
108-
##### Enable Apple as a provider
109-
Now, you can finally enable Apple as an OAuth provider!
110-
111-
Go to `web/src/auth.ts`, and make the following change:
112-
```diff
113-
const oAuthClient = createOAuthClient({
114-
enabledProviders: {
115-
+ apple: true
116-
},
117-
})
118-
```
119-
120-
Then, go to `api/src/functions/auth.ts`, and make the following change:
121-
```diff
122-
const oAuthHandler = new OAuthHandler(event, context, authHandler, {
123-
oAuthModelAccessor: 'oAuth',
124-
enabledProviders: {
125-
+ apple: true,
126-
},
127-
})
128-
```
129-

0 commit comments

Comments
 (0)