-
Notifications
You must be signed in to change notification settings - Fork 864
Add SDK-specificity to Authentication flows, User management, and Session management sections #2595
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…in permissions Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
SarahSoutoul
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have left a few comments, but overall, LGTM!
| const clerkResponse = await createClerkClient({ | ||
| secretKey: process.env.CLERK_SECRET_KEY, | ||
| }).users.getUserOauthAccessToken(userId, provider) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could init clerkClient separately for a cleaner example and more in-line with the other examples
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you need the userId passed from getAuth which relies on the req
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| const clerkResponse = await createClerkClient({ | |
| secretKey: process.env.CLERK_SECRET_KEY, | |
| }).users.getUserOauthAccessToken(userId, provider) | |
| // Initialize the JS Backend SDK | |
| // This varies depending on the SDK you're using | |
| // https://clerk.com/docs/js-backend/getting-started/quickstart | |
| const clerkClient = await createClerkClient({ | |
| secretKey: process.env.CLERK_SECRET_KEY, | |
| }) | |
| // Use the JS Backend SDK to get the user's OAuth access token | |
| const clerkResponse = clerkClient.users.getUserOauthAccessToken(userId, provider) |
Split it up like this?
docs/guides/configure/auth-strategies/social-connections/overview.mdx
Outdated
Show resolved
Hide resolved
docs/guides/configure/auth-strategies/social-connections/overview.mdx
Outdated
Show resolved
Hide resolved
|
I think to be more in-line with pages like our quickstarts, we should move the overviews to be in the
But this would have a couple drawbacks:
|
cc9af27 to
cec9255
Compare
| const notionData = await notionResponse.json() | ||
|
|
||
| // Return the Notion data | ||
| return JSON.stringify({ notionData }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think similar to tanstack, react-router has a json() function for returning json objects (https://reactrouter.com/6.30.1/route/loader#returning-responses)
| // Initialize the JS Backend SDK | ||
| // This varies depending on the SDK you're using | ||
| // https://clerk.com/docs/js-backend/getting-started/quickstart | ||
| const clerkClient = createClerkClient({ | ||
| secretKey: process.env.CLERK_SECRET_KEY, | ||
| publishableKey: process.env.CLERK_PUBLISHABLE_KEY, | ||
| }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be initialized outside the handler
| <SignedIn> | ||
| Replace the email address with the email address you want to invite. Your Clerk Secret Key is already injected into the code snippet. | ||
| </SignedIn> | ||
|
|
||
| <SignedOut> | ||
| Replace the email address with the email address you want to invite. Update `YOUR_SECRET_KEY` with your Clerk Secret Key which can be found on the [**API keys**](https://dashboard.clerk.com/~/api-keys) page in the Clerk Dashboard. | ||
| </SignedOut> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I love this use of <SignedIn /> and <SignedOut /> in our docs ❤️
| export async function loader(args: Route.LoaderArgs) { | ||
| const { userId } = await getAuth(args) | ||
|
|
||
| await clerkClient.users.updateUserMetadata(userId, { | ||
| publicMetadata: { | ||
| birthday: '1990-01-01', | ||
| }, | ||
| }) | ||
|
|
||
| return { success: true } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be a react-router action
🔎 Previews:
Tip
Just to note that the most used SDKs in order: nextjs, react, express, expo, javascript, js backend
What changed?
{{ target: '_blank' }}following themFIXES DOCS-11112
Checklist