@usecocreate/sdk
This is the official npm package for the CoCreate SDK. It allows you to easily integrate with various social media platforms, like Twitter, to authenticate and manage user data. In this guide, we will show you how to install and use the @usecocreate/sdk
package in your project.
Installation
To install the package, run the following command in your project directory:
npm install @usecocreate/sdk
Usage
To use the @usecocreate/sdk package, simply import the required functions and use them in your project. In the example below, we will demonstrate how to use the connectTwitterLink
function to generate a link for connecting a user's Twitter Account.
import { twitter } from '@usecocreate/sdk';
import React from 'react';
function TwitterConnectButton() {
const link = twitter.connectTwitterLink({
clientId: '560d0d00-0f02-47e3-a1ae-c349bb46874e',
redirectUrl: 'http://localhost:3000/twitter_redirect_test',
userEmail: 'email@example.com',
sessionVerifier: 'my_session_verifier',
});
return (
<a href={link} target="_blank" rel="noopener noreferrer">
Connect Twitter
</a>
);
}
export default TwitterConnectButton;
Usage with React Native
To use the @usecocreate/sdk package with React Native it is necessary to install and import shims before importing the @usecocreate/sdk package.
import 'react-native-get-random-values';
import '@ethersproject/shims';
import { twitter } from '@usecocreate/sdk';
Documentation
The full documentation can be found on our website.