Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Go to Latest
function handleCallback
Re-export
import { handleCallback } from "https://deno.land/x/fathym_everything_as_code@v0.0.396/src/deno.deps.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; }>