Category: Laravel

James Bannister • August 30, 2021 • 3 minute read Like many other social providers, the open-source Socialite Providers organisation provides a driver for integrating with Apple. The setup experience is a little more complicated than many of the other providers out there, but Okta have a great tutorial/walkthrough for how to get this going.

You might ask why I've chosen the AuthServiceProvider for this; the AppleToken class is directly related to authentication and thus is perfectly at home in the AuthServiceProvider, you could opt for the AppServiceProvider, but I find this usually ends up being a dumping ground for bindings that didn't find a good home anywhere else: With the AppleToken class written, and the AuthServiceProvider providing the configuration it needs, we just need to use the AppleToken class to generate the token and update the Apple Socialite configuration on-the-fly during the callback request from Apple: By generating a JWT client secret on each request, we don't have to worry about this expiring or having to keep it updated every 6 months. If you're wondering how you might go about testing this in your application, I opted to parse the token and then run assertions against the values stored in the JWT.
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future. Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future.
Community Partners