GithubHelp home page GithubHelp logo

fiberinc / handshake Goto Github PK

View Code? Open in Web Editor NEW
69.0 2.0 3.0 17.86 MB

Handshake handles your OAuth flows with over 200 popular APIs. Setup and deploy to Vercel in 5 minutes. 🀝 🍭

Home Page: https://handshake.cool

License: MIT License

TypeScript 98.93% JavaScript 0.67% CSS 0.40%
integrations nextjs oauth typescript next-auth self-hosted api-authentication nodejs oauth2

handshake's Introduction


Handshake

Self-hosted app that handles OAuth against 200+ APIs.

TypeScript MIT License CI status



About

Handshake helps you get OAuth tokens to your users' accounts in over 200 apps and services. It's an open-source Next.js app that you can easily configure and deploy.

See the full list of providers.

How it works

Suppose you want to access your users' Salesforce data. You will need to your users for a Salesforce access token to communicate with the Salesforce API on their behalf. Handshake can help with you.

To acquire Salesforce credentials for a user, redirect them to:

https://YOUR_HANDSHAKE_URL/auth/salesforce/redirect
  ?state=123456&
  &callback_uri=https://app.example.com/integrations

Where YOUR_HANDSHAKE_URL is something like https://handshake.example.com or wherever you want to host this app.

Handshake will then handle all the OAuth dance with Salesforce on your behalf. We will redirect the user to a Salesforce page where they can authorize your app to access their data. Salesforce will then redirect the user back to YOUR_HANDSHAKE_URL, from where we will redirect the user back to you.

Setup

Clone the project to your machine:

git clone https://github.com/fiberinc/handshake.git

Install dependencies:

cd handshake
pnpm i

Build the project:

pnpm build

Set environment variables

Duplicate the .env.example file within the app folder:

cp app/.env.example app/.env

In the new file, replace the values for ALLOWED_REDIRECT_HOST and SESSION_SECRET.

Configure your providers

Modify the app/options.ts file to include the providers you want to use:

import { HandshakeOptions, GitHub } from "handshake";

const options: HandshakeOptions = {
  // Register the providers you want to use, entering the
  // required credentials for each of them.
  handlers: [
    GitHub({
      clientId: process.env.GITHUB_CLIENT_ID!,
      clientSecret: process.env.GITHUB_CLIENT_SECRET!,
      scopes: ["repo"],
    }),
  ],
  // Tell Handshake which hosts it can redirect users back to. This is a
  // security measure to prevent malicious redirects.
  allowedRedirectHosts: [process.env.ALLOWED_REDIRECT_HOST],
  // Set a unique secret to sign session cookies.
  secret: process.env.SESSION_SECRET!,
};

Make sure to place sensitive information in your .env file.

You can now run your app:

cd app
pnpm dev

If you navigate to localhost:3000, you should see a list of all the configured providers:

Deploy

Deploy the app to Vercel by running, from the root folder:

vercel deploy

You must call vercel deploy from the root folder, even though the Next.js app folder lives within app/. The app code needs the handshake/ folder, which otherwise won't be available.

The command may tell you "No framework detected" instead of detecting Next.js as your framework. Steps to fix this are outlined below.

Fix project root and framework preset in Vercel

Once your project exists within Vercel, go to Settings > General.

First, set "Framework Preset" setting to "Next.js".

Then, set the "Root Directory" to app. This will tell Vercel to look for the actual Next.js code in the right folder.

Upload environment variables to Vercel

Set SESSION_SECRET, ALLOWED_REDIRECT_HOST and any other secrets you're using by going to Settings > Environment Variables, or directly via the Vercel CLI.

FAQ

Can you add support for X provider?

Yes! Please open an issue or reach out to us at [email protected].

How is this different from next-auth or passport?

Libraries like next-auth and passport help you sign users into your app using their third-party identities. You implement buttons that say "Sign In With Google" or "Sign In With Github".

In contrast, Handshake help you acquire access tokens to your users' accounts in other apps. It's authorization instead of authentication. Handshake actually uses next-auth's large catalog of OAuth provider information under the hood.

Contributing

Thank you for considering contributing to Handshake! If you believe you found a bug, open an issue. To add new features or make improvements to the code, create a pull request.

License

MIT

handshake's People

Contributors

felipap avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

handshake's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Rate-Limited

These updates are currently rate-limited. Click on a checkbox below to force their creation now.

  • chore(deps): update dependency @types/node to v18.19.33
  • chore(deps): update dependency @types/react to v18.3.2
  • fix(deps): update dependency @floating-ui/react to v0.26.14
  • fix(deps): update dependency jose to v5.3.0
  • chore(deps): update actions/checkout action to v4
  • chore(deps): update actions/setup-node action to v4
  • chore(deps): update codecov/codecov-action action to v4
  • chore(deps): update dependency @types/node to v20
  • chore(deps): update dependency @typescript-eslint/eslint-plugin to v7
  • chore(deps): update dependency eslint to v9
  • chore(deps): update dependency eslint-plugin-jest to v28
  • chore(deps): update dependency node-fetch to v3
  • chore(deps): update dependency tsup to v8
  • chore(deps): update pnpm to v9
  • fix(deps): update dependency chalk to v5
  • πŸ” Create all rate-limited PRs at once πŸ”

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Ignored or Blocked

These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.

Detected dependencies

github-actions
.github/workflows/ci.yml
  • actions/checkout v3
  • pnpm/action-setup v2
  • actions/setup-node v3
  • actions/checkout v3
  • pnpm/action-setup v2
  • actions/setup-node v3
  • codecov/codecov-action v3
npm
app/package.json
  • @floating-ui/react ^0.26.6
  • @radix-ui/react-icons ^1.3.0
  • chalk 4
  • cookie ^0.6.0
  • http-errors ^2.0.0
  • jose ^5.2.2
  • next 14.1.0
  • react ^18
  • react-dom ^18
  • react-hot-toast ^2.4.1
  • react-use ^17.5.0
  • tailwind-merge ^2.2.1
  • zod ^3.22.4
  • @types/cookie ^0.6.0
  • @types/http-errors ^2.0.4
  • @types/node ^20
  • @types/react ^18
  • @types/react-dom ^18
  • autoprefixer ^10.0.1
  • eslint ^8
  • eslint-config-next 14.1.0
  • postcss ^8
  • tailwindcss ^3.3.0
  • typescript ^5
handshake/package.json
  • chalk 4
  • http-errors ^2.0.0
  • next-auth ^4.24.6
  • openid-client ^5.6.4
  • type-fest ^4.10.3
  • zod ^3.22.4
  • @types/http-errors ^2.0.4
  • @types/jest ^29.5.12
  • @types/node 18.19.32
  • @types/node-fetch ^2.6.11
  • @types/react ^18.2.5
  • @typescript-eslint/eslint-plugin ^6.19.1
  • eslint-plugin-jest ^27.9.0
  • jest ^29.7.0
  • next 13.5.4
  • node-fetch ^2.6.13
  • react ^18.2.0
  • ts-jest ^29.1.2
  • tsup ^6.1.3
  • typescript ^5.1.6
  • next 13.5.4
  • react ^18.2.0
  • pnpm 8.6.10
package.json
  • @typescript-eslint/eslint-plugin ^6.19.1
  • eslint-config-prettier 9.1.0
  • eslint-plugin-prettier 5.1.3
  • prettier ^3.0.3
  • prettier-plugin-organize-imports ^3.2.3
  • prettier-plugin-tailwindcss ^0.5.3
  • turbo ^1.10.15
  • typedoc ^0.25.8
  • pnpm 8.6.10

  • Check this box to trigger a request for Renovate to run again on this repository

Missing providers

Instagram
Zenefits
Facebook
Intercom
Gitlab
Airtable
Segment
Mailchimp
Notion
Twitch
Sendgrid
Zoom
Reddit
Twitter
Jira
Tiktok
Atlassian
Apollo
Gmail
Sage
Monday
Stripe
Youtube
Front
Discord
Asana
Linear
Bitbucket
Linkedin
Quickbooks
Outreach
Box
Hubspot
Github
Confluence
Zendesk
Netsuite
Klaviyo
Salesforce
Brex
Xero
Netsuit
Typeform
Shopify
Dropbox
Paypal
Figma
Salesloft
Hubspot
Intuit
Calendly
Strava
Splitwise
Docusign
Pipedrive
Deel
Slack
Gusto
Amplitude
One drive
Guru
Gong
Digital ocean
Close
Yandex
Mixpanel
Zoho
Gorgias
Ramp

Allow signing of call to "/redirect"

Let the developer sign the call to HANDSHAKE_HOST/auth/API_NAME/redirect, in case theyΒ want to prevent public access to their third-party app.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.