Skip to content

internalG/next-proxy-test

 
 

Repository files navigation

Proxy with Next.js and GitHub OAuth

This is a Next.js project bootstrapped with create-next-app. Its purpose is to test proxy support using Node.js environment variables.

Getting Started

Follow the following steps to set up and run the app:

  1. Generate an AUTH_SECRET Run npx auth secret Auth.js requires an AUTH_SECRET environment variable. This is a random string used to encrypt tokens and email verification hashes.

  2. Configure GitHub OAuth Credentials Create a GitHub OAuth application:

    • Go to GitHub → Settings → Developer settings → OAuth Apps.
    • Click New OAuth App and fill in the required fields.
    • Get your Client ID and Client Secret.

    For more detailed instructions check out: https://authjs.dev/guides/configuring-github

  3. After completing the steps above, your .env.local file should look like:

     AUTH_SECRET={AUTH_SECRET}
     AUTH_GITHUB_ID={CLIENT_ID}
     AUTH_GITHUB_SECRET={CLIENT_SECRET}
  4. Start the Proxy Server You can use the provided proxyserver.js or substitute it with your own proxy server.

  5. Run the development server with NODE_USE_ENV_PROXY set to 1, along with HTTP_PROXY / HTTPS_PROXY environment variables:

    Example, for this app with proxy server proxyserver.js:

     NODE_USE_ENV_PROXY=1 \
     HTTP_PROXY=http://127.0.0.1:8000 \
     npm run dev
  6. You should now see all requests to api.github.com logged by the proxy server.

About

Proxy with Next.js

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 80.6%
  • TypeScript 19.4%