Implement OAuth2 login flow
Implement a full OAuth2 login flow with redirect, token exchange, profile fetch, and session creation. Includes state parameter CSRF protection.
Preview
Copy prompt
Implement a complete OAuth2 authorization code flow for [Provider, e.g. Google or GitHub] in [Language/Framework]. Handle the initial redirect to the authorization server, exchange the returned code for access and refresh tokens, fetch the authenticated user's profile, create or update the user record in the database, and issue a session or JWT for subsequent requests. Include state parameter validation to protect against CSRF.
More
Code Generation
Prompts
