You are logged in as {props.user.email}
You are not logged in
You are logged in as {props.user.email}
} else { returnYou are not logged in
} }) export default YourApp ``` -------------------------------- ### Deploy Chalice Application Source: https://docs.propelauth.com/getting-started/example-apps/react-python-chalice Command to deploy the Chalice backend application to AWS. ```bash chalice deploy ``` -------------------------------- ### Install Go MCP SDK Source: https://docs.propelauth.com/mcp-authentication/examples/go Add the official Model Context Protocol SDK to your Go project dependencies. ```text require github.com/modelcontextprotocol/go-sdk ``` -------------------------------- ### Initialize PropelAuth Client and Create Magic Link Source: https://docs.propelauth.com/reference/backend-apis/go Initializes the PropelAuth client with authentication credentials and demonstrates how to create a magic link for user authentication. Requires the auth URL and API key. ```go client, err := propelauth.InitBaseAuth(authUrl, apiKey, nil) response, err := client.CreateMagicLink(models.CreateMagicLinkParams{ Email: "test@example.com", }) ``` -------------------------------- ### Configure HTTP Server Endpoints in Go Source: https://docs.propelauth.com/mcp-authentication/examples/go Sets up HTTP handlers for different routes including a main endpoint, a health check, and an OAuth protected resource metadata endpoint. It then starts the HTTP server. ```Go http.HandleFunc("/mcp", authenticatedHandler.ServeHTTP) // Health check endpoint. http.HandleFunc("/health", func(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json") json.NewEncoder(w).Encode(map[string]string{ "status": "healthy", "time": time.Now().Format(time.RFC3339), }) }) // This endpoint provides OAuth configuration information to clients. metadata := &oauthex.ProtectedResourceMetadata{ Resource: mcpServerUrl + "/mcp", AuthorizationServers: []string{ propelauthAuthUrl + "/oauth/2.1", }, ScopesSupported: []string{"read:user_data"}, } http.Handle("/.well-known/oauth-protected-resource", auth.ProtectedResourceMetadataHandler(metadata)) // Start the HTTP server. log.Println("Authenticated MCP Server") log.Println("========================") log.Println("Server starting on", *httpAddr) log.Fatal(http.ListenAndServe(*httpAddr, nil)) } ``` -------------------------------- ### Chalice Deployment Output Source: https://docs.propelauth.com/getting-started/example-apps/react-python-chalice This example shows the typical output when deploying a Chalice application using the `chalice deploy` command. It indicates the creation of a deployment package, updates to IAM policies and Lambda functions, and the provisioning of a REST API. The output includes the Lambda ARN and the Rest API URL for the deployed application. ```bash $ chalice deploy Creating deployment package. Updating policy for IAM role: example-dev Updating lambda function: example-dev Updating rest API Resources deployed: - Lambda ARN: {ARN} - Rest API URL: https://{uniquestring}.execute-api.us-west-2.amazonaws.com/api/ ``` -------------------------------- ### UserInfo Endpoint Authorization Header Example Source: https://docs.propelauth.com/sso/enterprise-sso/other-providers Demonstrates how to pass an access token in the Authorization header for the UserInfo endpoint. This is crucial for retrieving user details from your authentication provider. ```http Authorization: Bearer {ACCESS_TOKEN} ``` -------------------------------- ### Protect API Endpoints with PropelAuth Source: https://docs.propelauth.com/getting-started/quickstart-be Uses the auth.require_user dependency to restrict access to specific FastAPI routes. Requests without a valid access token will receive a 401 Unauthorized response. ```python from fastapi import Depends from propelauth_fastapi import User @app.get("/api/whoami") async def root(current_user: User = Depends(auth.require_user)): return {"user_id": f"{current_user.user_id}"} ``` -------------------------------- ### POST /api/magic-link Source: https://docs.propelauth.com/reference/backend-apis/go Example of initializing the PropelAuth client and calling backend APIs to perform actions like creating a magic link. ```APIDOC ## POST /api/magic-link ### Description Initializes the PropelAuth client and triggers a magic link creation request. ### Method POST ### Request Body - **Email** (string) - Required - The email address to send the magic link to. ### Request Example { "Email": "test@example.com" } ### Response Example { "url": "https://auth.example.com/magic-link/..." } ``` -------------------------------- ### Setup PropelAuth AuthProvider in Next.js Source: https://docs.propelauth.com/getting-started/example-apps/react-flask Integrates the PropelAuth AuthProvider into the Next.js application's root component (_app.tsx). It requires the authentication URL from the PropelAuth dashboard to manage user sessions. ```typescript import type { AppProps } from 'next/app' import { AuthProvider } from '@propelauth/react' export default function App({ Component, pageProps }: AppProps) { return ({response ? JSON.stringify(response) : "Loading..."}