5-Minute Twitter Integration Guide

Leverage Twitter Within Your Brand Experience

Integrating With Twitter Connect in 5 Minutes

Twitter Connect is a simple way to let users log in to your app using their Twitter account.

This module does the heavy lifting of integrating your Co:Create app with Twitter Connect.
It takes in your Co:Create app's settings and returns a link that you can use to connect a user's Twitter account to your app.

The link will redirect the user to Twitter, where they can log in to their Twitter account and authorize your app to access their account.

Prerequisites

  • Node.js 16 LTS or higher

  • NPM or Yarn

  • Your app to serve on localhost:3000

Installation

    npm install @usecocreate/sdk

Usage

Import the twitter module from the SDK.

    import { twitter } from "@usecocreate/sdk";

The example below shows the connectTwitterLink function that returns a Twitter connect link based on your Co:Create app's settings:

    import React from "react";
    import { twitter } from "@usecocreate/sdk";

    function TwitterConnectButton() {
    const link = twitter.connectTwitterLink({
        clientId: "560d0d00-0f02-47e3-a1ae-c349bb46874e",
        redirectUrl: "http://localhost:3000/twitter_test",
        userEmail: "[email protected]",
        sessionVerifier: "my_session_verifier",
    });

    return (
        <a href={link} target="_blank" rel="noopener noreferrer">
        Connect Twitter
        </a>
    );
    }
    export default TwitterConnectButton;

Parameters

NameTypeDescriptionoptional
clientIdstringThe client id from your Co:Create Admin Portal.no
redirectUrlstringThe URL to redirect to after the user has connected their Twitter account.no
userEmailstringThe user's email.no
sessionVerifierstringA unique token that is sent back in the redirect URL. This can be used to verify that the callback is coming from Co:Create.no

πŸ‘

Get Help

If you get stuck at any time, reach out to us on Discord or contact us via email at [email protected].