>>
Apple OAuth Provider
Authenticate using Apple OAuth provider. Supports both OIDC and OAuth2 protocols.
Callback or Redirect URL pattern
https://example.com/api/{name}/oauth/callback/apple
For OAuth2
tssrc/payload.config.ts
import { buildConfig } from "payload/config";
import { authPlugin } from "payload-auth-plugin";
import { AppleOAuth2Provider } from "payload-auth-plugin/providers";
export default buildConfig({
// --- rest of the config
plugins: [
// --- rest of the plugins
authPlugin({
providers: [
AppleOAuth2Provider({
client_id: process.env.PROVIDER_CLIENT_ID as string,
client_secret: process.env.PROVIDER_CLIENT_SECRET as string,
}),
],
}),
],
});
For OIDC
tssrc/payload.config.ts
import { buildConfig } from "payload/config";
import { authPlugin } from "payload-auth-plugin";
import { AppleOIDCAuthProvider } from "payload-auth-plugin/providers";
export default buildConfig({
// --- rest of the config
plugins: [
// --- rest of the plugins
authPlugin({
providers: [
AppleOIDCAuthProvider({
client_id: process.env.PROVIDER_CLIENT_ID as string,
}),
],
}),
],
});
Args
- client_id:
Type: string
Description: client_id
is a string generated by Apple to identify your Payload app.
Optional: No.
ts
{
client_id: "";
}
- client_secret:
Type: string
Description: client_secret
is a private key generated by Apple to authenticate your Payload app. This is not required if you are using AppleOIDCAuthProvider.
Optional: No.
ts
{
client_secret: "";
}
- params:
Type: Record<string, string>
Description: params
any additional parameters to pass to the IDP for authorization.
Optional: Yes.
ts
{
params: {
// additional parameters
}
}
Returns
- provider OAuth2ProviderConfig for
AppleOAuth2Provider
- provider OIDCProviderConfig for
AppleOIDCAuthProvider