Go Summarize

Dev Chats - Authenticating your Stripe Customers with Clerk

authentication#stripe#dev chats#@cjav_dev#@irreverentmike
1K views|1 years ago
💫 Short Summary

In this Dev Chat, Mike and Colin from Clerk.dev talk about the new update on the Stripe Payment API which allows checking the readiness of a wallet to make payments and the deprecation of the redirect to checkout method in the Stripe API. They also discuss the new hub for no code documentation on stripe.com and the ability to present local currencies in Stripe Checkout. Mike mentions two upcoming events where he will be speaking, and Colin demonstrates the integration of Clerk.dev with a Next.js app for authentication.The video discusses the integration of Next.js with Clerk for backend authentication, demonstrating the new middleware approach for obtaining user information and highlighting the management of authentication and session state. It also covers the web hooks for data integration, user metadata management, and future features, such as organization management. The integration of Next.js with Clerk provides a seamless and secure authentication solution for web and mobile applications.

✨ Highlights
📊 Transcript
✦
The video begins with a discussion on authentication for Stripe customers in both B2B and B2C spaces, with a focus on React applications and Next.js.
02:21
The "clerk.dev" documentation provides walkthroughs for authenticating Stripe customers in React applications.
There are options for Redwood JS in the clerk.dev documentation.
An updated API on payment requests called "paymentrequest.canMakePayment" has been launched, allowing users to check if a wallet is ready to make a payment.
✦
A new section on stripe.com docs, focused on 'no code' documentation, is introduced, providing options for working with Stripe without writing code.
05:24
The 'no code' documentation is designed for quick integration without extensive coding.
Features include a pricing table that generates a script tag for embedding and payment links for creating URLs for product purchases.
✦
CJ and Colin discuss Clerk's inspiration and the focus on providing React components for easy UI integration.
09:02
Clerk's inspiration came from tools like Stripe Checkout, where the UI was great for customers but the off-side wasn't as satisfying.
Clerk has deployed React components that make it easy to integrate a beautiful UI into the application.
The user button component in Clerk provides the avatar and login/logout options out of the box.
✦
CJ and Colin talk about authentication and customization in Clerk.dev, demonstrating how to manage users and authenticate them from within the Clerk.dev dashboard.
14:44
In the past, building such authentication and management features would have required a lot of time and effort, but with Clerk.dev, it can be done more easily.
CJ mentions the possibility of sending a password reset email and managing users from within the Clerk.dev dashboard.
Authentication options like Twitter login can be added by checking a box in the Clerk.dev dashboard.
✦
Colin demonstrates how JWTs can be generated for database queries from the front end using Clerk.dev.
21:49
Colin showcases the JWT with history claims for a default user.
He mentions the ability to create JWTs for database vendors.
Colin expresses the desire to do more with React and Stripe in the future.
✦
The speaker discusses the ease of adding authentication and user management features with Clerk.dev, highlighting the capabilities and future possibilities of the platform.
28:20
In the past, adding authentication and user management required significant time and effort, but now with Clerk.dev, it can be done more easily.
The ability to send a password reset email and manage users from within the Clerk.dev dashboard is coming or already available.
Various authentication options are available, and the speaker mentions the quick approval of test applications in web3.
✦
The new middleware approach in Next.js allows for quick and secure retrieval of user ID and session ID.
35:36
The back end stuff on Next.js now uses the new middleware.
With the middleware and API endpoint, the user ID and session ID can be obtained, which is secure and uses JWT that refreshes every minute.
✦
The authentication state is managed through endpoints, and in production, HTTP only cookies are used.
39:27
In development, third-party cookies are used due to the different domain than localhost 3000.
In production, HTTP only cookies are used because developers in prod set a cname to the API.
The 'redirect required' message is not customizable but won't be visible to end users.
Web hooks are available for notification about different events.
✦
The guest discusses two approaches to handling data: just-in-time and updating the database with user data.
43:54
Query the database to check if there is a corresponding ID for the user
Create and save the ID if it doesn't exist in the database
Metadata can be saved directly to the clerk object
Update the user object when receiving the user.created event from clerk
✦
Public metadata can be read from the front end but not changed, while unsafe metadata can be set and saved from the front end.
49:33
Private metadata is not shown in the demo
Public metadata can be read but not changed from the front end
Unsafe metadata is for analytics or quick tests
The speaker demonstrated setting and saving metadata from the front end
✦
Next.js, Remix, React, Redwood, Gatsby, and Expo are supported, and organization management and more integrations are planned for the future.
51:29
Clerk is focusing on the React ecosystem and plans to support more integrations in the future.
Organization management is the next big feature, with APIs already in place and React side under development.
Clerk wants to provide a broad user model as a service and focus on user-centric features.
💫 FAQs about This YouTube Video

1. What are some of the new updates in the Stripe API mentioned in the video?

In the video, the following new updates in the Stripe API are mentioned: 1. Updated API on payment requests called 'paymentrequest.canMakePayment' 2. Deprecated method 'redirect to checkout' on the Stripe API 3. Introduction of a new docs section on no code on stripe.com 4. Opportunity to present local currencies in Stripe Checkout 5. Upcoming events in November, including the Caribbean developers conference and the open source conference in Raleigh, North Carolina

2. How does the video demonstrate the integration of Clerk.dev with a Next.js app for authentication?

The video demonstrates the integration of Clerk.dev with a Next.js app for authentication by showing the process of installing Clerk.dev, setting up environment variables, and incorporating authentication components such as sign-in and sign-out. The demonstration includes the usage of Clerk.dev's react SDK and the _app.tsx file for handling the authentication logic.

3. What capabilities does Clerk.dev offer for managing user authentication and profiles?

Clerk.dev offers capabilities for managing user authentication and profiles, including the ability to customize the authentication process, integrate with various authentication providers, and manage user metadata. Additionally, Clerk.dev provides options for implementing multi-factor authentication (MFA), allowing users to set up MFA options and secure their accounts. The platform also supports JWT generation for querying from the front end and allows for extensive customization of the UI and user experience.

4. How does the new middleware in Next.js allow for quick and secure user ID retrieval?

With the new middleware in Next.js, it is now possible to quickly and securely retrieve the user ID and session ID, which are secured using JWT. This allows for a more efficient and streamlined process, ensuring that the user's authentication and identification are handled with the highest level of security.

5. Is the 'redirect required' message customizable in the clerk demo?

No, the 'redirect required' message is not customizable in the clerk demo. However, it is important to note that this message does not exist in production and won't be visible to end users. The demo showcases the back-end power and management of the session state, ensuring a smooth and seamless user experience.

6. What endpoints are used to manage the authentication state in development and production?

In development, third-party cookies are used for managing the authentication state due to the different domain than localhost 3000. In production, HTTP only cookies are employed, enabled by developers setting a cname to the API, ensuring a secure authentication process for end users.

7. How can the user's metadata be updated and managed in the clerk demo?

The clerk demo demonstrates the management of user metadata, including public and private metadata. Public metadata can be read from the front end but not changed, while private metadata is not shown in the demo. Additionally, there is an option for unsafe metadata, which can be set and saved from the front end for specific use cases such as analytics or quick tests.

8. What future features and integrations can be expected from clerk?

Clerk is planning to introduce organization management as the next big feature, allowing B2B SaaS users to create, manage, and switch between multiple organizations with custom roles and permissions. Furthermore, clerk aims to integrate with other services such as Stripe for automatic creation of customer objects and enhance the user experience with more user-centric features.