GithubHelp home page GithubHelp logo

authorizerdev / authorizer-react Goto Github PK

View Code? Open in Web Editor NEW
21.0 4.0 12.0 5.59 MB

React library for [authorizer.dev](https://authorizer.dev/)

License: MIT License

JavaScript 0.53% HTML 0.38% TypeScript 95.67% CSS 3.42%
react authorizer hacktoberfest

authorizer-react's Introduction

authorizer-react

Authorizer React SDK allows you to implement authentication in your React application quickly. It also allows you to access the user profile.

Here is a quick guide on getting started with @authorizerdev/authorizer-react package.

Step 1 - Create Instance

Get Authorizer URL by instantiating Authorizer instance and configuring it with necessary environment variables.

Step 2 - Install package

Install @authorizerdev/authorizer-react library

npm i --save @authorizerdev/authorizer-react
OR
yarn add @authorizerdev/authorizer-react

Step 3 - Configure Provider and use Authorizer Components

Authorizer comes with react context which serves as Provider component for the application

import {
  AuthorizerProvider,
  Authorizer,
  useAuthorizer,
} from '@authorizerdev/authorizer-react';

const App = () => {
  return (
    <AuthorizerProvider
      config={{
        authorizerURL: 'http://localhost:8080',
        redirectURL: window.location.origin,
        clientID: 'YOUR_CLIENT_ID',
      }}
    >
      <LoginSignup />
      <Profile />
    </AuthorizerProvider>
  );
};

const LoginSignup = () => {
  return <Authorizer />;
};

const Profile = () => {
  const { user } = useAuthorizer();

  if (user) {
    return <div>{user.email}</div>;
  }

  return null;
};

Commands

Local Development

The recommended workflow is to run authorizer in one terminal:

npm start # or yarn start

This builds to /dist and runs the project in watch mode so any edits you save inside src causes a rebuild to /dist.

Then run either Storybook or the example playground:

Example

Then run the example inside another:

cd example
npm i # or yarn to install dependencies
npm start # or yarn start

The default example imports and live reloads whatever is in /dist, so if you are seeing an out of date component, make sure TSDX is running in watch mode like we recommend above. No symlinking required, we use Parcel's aliasing.

To do a one-off build, use npm run build or yarn build.

To run tests, use npm test or yarn test.

Configuration

Code quality is set up for you with prettier, husky, and lint-staged. Adjust the respective fields in package.json accordingly.

Jest

Jest tests are set up to run with npm test or yarn test.

Bundle analysis

Calculates the real cost of your library using size-limit with npm run size and visulize it with npm run analyze.

authorizer-react's People

Contributors

anik-ghosh-au7 avatar arabovs avatar jyash97 avatar kdichev avatar lakhansamani avatar peter-wd-1 avatar scaletech-milan avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar

authorizer-react's Issues

Add ability to login via facebook

Feature Description

Add ability to login via facebook

Describe the solution you'd like

Describe alternatives you've considered

Additional context

Is Twitch login not backward compatible with the previous versions?

I have been using authorizer-react package for a month now and recently it started throwing error when I ran npm install
Error: Cannot query field "is_twitch_login_enabled" on type "Meta". Did you mean "is_twitter_login_enabled", "is_github_login_enabled", "is_google_login_enabled", "is_apple_login_enabled", or "is_facebook_login_enabled"?. I am using exact version 1.1.13 of authorizer. Ideally, it should not happened.

I checked the package-lock.json file and can see I am using authorizer.js 1.2.18. I reverted the package-lock.json and used npm ci to install the dependencies and it worked.
Attaching the ss for reference.

  • package-lock.json
Screenshot 2023-12-07 at 7 36 15 PM
  • React Error
    Screenshot 2023-12-07 at 7 04 07 PM

Create signup tab

  • Social login based on config
  • Signup form with email, password, confirm password
  • Submit button
  • On successful signup show message
  • Else show errors from server
  • Validations for signup -> valid email, valid password, valid confirm password

Create login tab

  • login form
  • based on config social login buttons
  • submit button

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.