{error.message}
} -Data fetched with provider token:
+{JSON.stringify(allRepos, null, 2)}
+ user:
+{JSON.stringify(user, null, 2)}
+ >
+ )
}
export const getServerSideProps = withPageAuth({
redirectTo: '/',
- async getServerSideProps(ctx) {
- // Retrieve provider_token from cookies
- const provider_token = ctx.req.cookies['sb-provider-token']
- // Get logged in user's third-party id from metadata
- const { user } = await getUser(ctx)
- const userId = user?.user_metadata.provider_id
- const profile: Profile = await (
- await fetch(`https://api.example.com/users/${userId}`, {
- method: 'GET',
- headers: {
- Authorization: `Bearer ${provider_token}`,
- },
- })
+ async getServerSideProps(ctx, supabase) {
+ const {
+ data: { session },
+ error,
+ } = await supabase.auth.getSession()
+ if (error) {
+ throw error
+ }
+ if (!session) {
+ return { props: {} }
+ }
+
+ // Retrieve provider_token & logged in user's third-party id from metadata
+ const { provider_token, user } = session
+ const userId = user.user_metadata.user_name
+
+ const allRepos = await (
+ await fetch(
+ `https://api.github.com/search/repositories?q=user:${userId}`,
+ {
+ method: 'GET',
+ headers: {
+ Authorization: `token ${provider_token}`,
+ },
+ }
+ )
).json()
- return { props: { profile } }
+
+ return { props: { allRepos, user } }
},
})
```
@@ -355,6 +426,7 @@ export const config = {
```
- The `supabaseClient` and `supabaseServerClient` have been removed in favor of the `createBrowserSupabaseClient` and `createServerSupabaseClient` methods. This allows you to provide the CLI-generated types to the client:
+
```js
// client-side
import type { Database } from 'types_db';
@@ -373,12 +445,14 @@ export const config = {
res.status(200).json({ name: user?.name ?? '' })
}
```
+
- The `UserProvider` has been replaced by the `SessionContextProvider`. Make sure to wrap your `pages/_app.js` componenent with the `SessionContextProvider`. Then, throughout your application you can use the `useSessionContext` hook to get the `session` and the `useSupabaseClient` hook to get an authenticated `supabaseClient`.
- The `useUser` hook now returns the `user` object or `null`.
- Usage with TypeScript: You can pass types that were [generated with the Supabase CLI](/docs/reference/javascript/typescript-support#generating-types) to the Supabase Client to get enhanced type safety and auto completion:
+
```js
// Creating a new supabase client object:
- import { Database } from '../db_types';
+ import { Database } from '../database.types';
const [supabaseClient] = useState(() =>
createBrowserSupabaseClient- Sign in via magic link with your email below -
-Account page will go here.
+ )}- You can download the latest DPA document through our{' '} - security portal, or by - submitting your email here. -
+You can download our latest DPA document by submitting your email here.
{formSubmitted ? (diff --git a/apps/www/pages/legal/soc2.tsx b/apps/www/pages/legal/soc2.tsx index c58ebe4dfef..f5fc2a80fac 100644 --- a/apps/www/pages/legal/soc2.tsx +++ b/apps/www/pages/legal/soc2.tsx @@ -18,11 +18,7 @@ const SOC2 = () => { getting certified for SOC2 Type 2 and HIPAA next.
-- You can request for our latest SOC 2 document either through our{' '} - security portal, or by submitting - your request here. -
+You can request for our latest SOC 2 document by submitting your request here.