Skip to main content
Module

x/deno_kv_oauth/mod.ts>handleCallback

High-level OAuth 2.0 powered by Deno KV.
Latest
function handleCallback
Re-export
import { handleCallback } from "https://deno.land/x/deno_kv_oauth@v0.10.0/mod.ts";

Handles the OAuth callback request for the given OAuth configuration, and then redirects the client to the success URL set in signIn. The request URL must match the redirect URL of the OAuth application.

Examples

Example 1

import { handleCallback, createGitHubOAuthConfig } from "https://deno.land/x/deno_kv_oauth@$VERSION/mod.ts";

const oauthConfig = createGitHubOAuthConfig();

export async function handleOAuthCallback(request: Request) {
  const { response, tokens, sessionId } = await handleCallback(
    request,
    oauthConfig,
  );

   // Perform some actions with the `tokens` and `sessionId`.

   return response;
}

Parameters

request: Request
oauthConfig: OAuth2ClientConfig
optional
options: HandleCallbackOptions

Returns

Promise<{ response: Response; sessionId: string; tokens: Tokens; }>