OAuth with PKCE flow for SSR
Learn how to configure OAuth authentication in your server-side rendering (SSR) application to work with the PKCE flow.
Setting up SSR client
Check out our guide for creating a client to learn how to install the necessary packages, declare environment variables, and create a Supabase client configured for SSR in your framework.
Create API endpoint for handling the code
exchange
In order to use OAuth we will need to setup a endpoint for the code
exchange, to exchange an auth code
for the user's session
, which is set as a cookie for future requests made to Supabase.
Let's point our .signInWithOAuth
method's redirect to the callback route we create above: