0.6.6 • Published 3 months ago

@clerk/chrome-extension v0.6.6

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

@clerk/chrome-extension

Chat on Discord Clerk documentation Follow on Twitter

Changelog · Report a Bug · Request a Feature · Ask a Question


Overview

Clerk is the easiest way to add authentication and user management to your chrome extension. To gain a better understanding of the Clerk React SDK and Frontend API, refer to the Node SDK and Backend API documentation.

Getting Started

To use this package you should first create a Clerk application and retrieve a Publishable Key for you application to be used as environment variables REACT_APP_CLERK_PUBLISHABLE_KEY.

Prerequisites

  • Node.js v14+

Installation

npm install @clerk/chrome-extension

Usage

Standalone usage snippet:

// App.tsx
import { SignedIn, SignedOut, SignIn, SignUp, ClerkProvider } from '@clerk/chrome-extension';
import { useNavigate, Routes, Route, MemoryRouter } from 'react-router-dom';

function HelloUser() {
  return <p> Hello user</p>;
}

const publishableKey = process.env.REACT_APP_CLERK_PUBLISHABLE_KEY || '';

function ClerkProviderWithRoutes() {
  const navigate = useNavigate();

  return (
    <ClerkProvider
      publishableKey={publishableKey}
      navigate={to => navigate(to)}
    >
      <Routes>
        <Route
          path='/sign-up/*'
          element={<SignUp signInUrl='/' />}
        />
        <Route
          path='/'
          element={
            <>
              <SignedIn>
                <HelloUser />
              </SignedIn>
              <SignedOut>
                <SignIn
                  afterSignInUrl='/'
                  signUpUrl='/sign-up'
                />
              </SignedOut>
            </>
          }
        />
      </Routes>
    </ClerkProvider>
  );
}

function App() {
  return (
    <MemoryRouter>
      <ClerkProviderWithRoutes />
    </MemoryRouter>
  );
}

export default App;

WebSSO usage snippet:

// App.tsx
// use same code with the above & add the syncSessionWithTab prop in <ClerkProvider/>

// ...
<ClerkProvider
  publishableKey={publishableKey}
  navigate={to => navigate(to)}
  syncSessionWithTab
>
  {/* ... */}
</ClerkProvider>
//...

Examples of a chrome extension using the @clerk/chrome-extension package for authentication can be found in our clerk-chrome-extension-starter github repository. The 2 supported cases (links to different branches of the same repository):

  • Standalone: The extension is using its own authentication
  • WebSSO: The extensions shares authentication with a website in the same browser

WebSSO required settings

Permissions (in manifest.json)

Host permissions (in manifest.json)

"host_permissions": ["*://YOUR_CLERK_FRONTEND_API_GOES_HERE/"],

Clerk settings

Add your chrome extension origin to your instance allowed_origins using BAPI:

curl  -X PATCH https://api.clerk.com/v1/instance \
      -H "Authorization: Bearer sk_secret_key" \
      -H "Content-type: application/json" \
      -d '{"allowed_origins": ["chrome-extension://extension_id_goes_here"]}'

Learn More

You can learn more in the Create React App documentation.

To learn React, check out the React documentation.

Support

You can get in touch with us in any of the following ways:

Security

@clerk/chrome-extension follows good practices of security, but 100% security cannot be assured.

@clerk/chrome-extension is provided "as is" without any warranty. Use at your own risk.

For more information and to report security issues, please refer to our security documentation.

License

This project is licensed under the MIT license.

See LICENSE for more information.

1.0.0-beta-v5.20

3 months ago

1.0.0-beta-v5.19

4 months ago

1.0.0-alpha-v5.18

4 months ago

1.0.0-alpha-v5.17

4 months ago

0.6.6

4 months ago

1.0.0-alpha-v5.15

4 months ago

1.0.0-alpha-v5.16

4 months ago

0.6.5

4 months ago

0.6.4

4 months ago

1.0.0-alpha-v5.14

4 months ago

0.6.3

4 months ago

1.0.0-alpha-v5.13

4 months ago

0.6.2

5 months ago

1.0.0-alpha-v5.12

5 months ago

0.6.1

5 months ago

1.0.0-alpha-v5.11

5 months ago

1.0.0-alpha-v5.10

5 months ago

0.6.0

5 months ago

0.5.8

5 months ago

0.5.7

5 months ago

1.0.0-alpha-v5.9

5 months ago

1.0.0-alpha-v5.8

5 months ago

0.5.6

5 months ago

0.5.5

5 months ago

1.0.0-alpha-v5.6

5 months ago

1.0.0-alpha-v5.7

5 months ago

1.0.0-alpha-v5.5

5 months ago

0.5.4

5 months ago

0.5.3

6 months ago

0.5.0

6 months ago

0.5.2

6 months ago

0.5.1

6 months ago

0.4.10

6 months ago

0.4.13

6 months ago

0.4.11

6 months ago

0.4.12

6 months ago

0.4.9

7 months ago

0.4.8

7 months ago

0.4.5

7 months ago

0.4.4

7 months ago

0.4.7

7 months ago

0.4.6

7 months ago

0.4.1

8 months ago

0.4.0

8 months ago

0.4.3

7 months ago

0.4.2

7 months ago

0.3.31

8 months ago

0.3.30

8 months ago

0.3.29

8 months ago

0.3.20

10 months ago

1.0.0-alpha-v5.4

5 months ago

1.0.0-alpha-v5.2

6 months ago

1.0.0-alpha-v5.3

6 months ago

1.0.0-alpha-v5.0

6 months ago

1.0.0-alpha-v5.1

6 months ago

0.3.28

8 months ago

0.3.27

8 months ago

0.3.26

9 months ago

0.3.25

10 months ago

0.3.24

10 months ago

0.3.23

10 months ago

0.3.22

10 months ago

0.3.21

10 months ago

0.3.19

10 months ago

0.3.18

10 months ago

0.3.17

10 months ago

0.3.8-snap.e2ec9c0

11 months ago

0.3.8-snap.2150b23

11 months ago

0.3.8

11 months ago

0.3.7

11 months ago

0.3.8-snap.46c588e

11 months ago

0.3.8-snap.a0dd011

11 months ago

0.3.8-snap.3210eda

11 months ago

0.3.8-snap.af9b738

11 months ago

0.3.8-snap.691991c

11 months ago

0.3.8-snap.cd256f5

11 months ago

0.3.8-snap.8fda67e

11 months ago

0.3.8-snap.5909c28

11 months ago

0.3.8-snap.9208293

11 months ago

0.3.9

11 months ago

0.3.16

11 months ago

0.3.15

11 months ago

0.3.14

11 months ago

0.3.13

11 months ago

0.3.12

11 months ago

0.3.11

11 months ago

0.3.10

11 months ago

0.3.8-snap.5fede9e

11 months ago

0.3.7-staging.1

11 months ago

0.2.7-staging.5

1 year ago

0.3.7-staging.0

11 months ago

0.2.7-staging.6

1 year ago

0.2.7-staging.3

1 year ago

0.2.7-staging.4

1 year ago

0.3.7-staging.4

11 months ago

0.3.7-staging.3

11 months ago

0.3.7-staging.2

11 months ago

0.3.1-staging.2

12 months ago

0.3.1-staging.1

12 months ago

0.2.8-staging.1

12 months ago

0.3.1-staging.0

12 months ago

0.2.8-staging.0

12 months ago

0.3.0

12 months ago

0.3.6

12 months ago

0.3.5

12 months ago

0.3.2

12 months ago

0.2.8-staging.3

12 months ago

0.3.1

12 months ago

0.2.8-staging.2

12 months ago

0.3.4

12 months ago

0.3.3

12 months ago

0.2.8-staging.4

12 months ago

0.3.2-staging.1

12 months ago

0.3.2-staging.0

12 months ago

0.3.5-staging.0

12 months ago

0.3.3-staging.0

12 months ago

0.3.3-staging.1

12 months ago

0.3.3-staging.2

12 months ago

0.3.6-staging.0

12 months ago

0.2.8

12 months ago

0.2.4-staging.0

1 year ago

0.2.4-staging.1

1 year ago

0.2.5-staging.0

1 year ago

0.2.7-staging.1

1 year ago

0.2.7-staging.2

1 year ago

0.2.7-staging.0

1 year ago

0.2.3-staging.4

1 year ago

0.2.3-staging.3

1 year ago

0.2.3-staging.5

1 year ago

0.2.3-staging.2

1 year ago

0.2.7

1 year ago

0.2.6

1 year ago

0.2.6-staging.0

1 year ago

0.2.3

1 year ago

0.2.5

1 year ago

0.2.4

1 year ago

0.2.3-staging.1

1 year ago

0.2.3-staging.0

1 year ago

0.2.2-staging.1

1 year ago

0.2.2-staging.0

1 year ago

0.2.2

1 year ago

0.2.1

1 year ago

0.2.1-staging.1

1 year ago

0.2.1-staging.0

1 year ago

0.2.0

1 year ago

0.2.0-staging.2

1 year ago

0.2.0-staging.1

1 year ago

0.2.0-staging.0

1 year ago