Coder Social home page Coder Social logo

react-auth's Introduction

Nhost

Nhost

Quickstart   •   Website   •   Docs   •   Blog   •   Twitter   •   Discord


Nhost is an open source Firebase alternative with GraphQL, built with the following things in mind:

  • Open Source
  • GraphQL
  • SQL
  • Great Developer Experience

Nhost consists of open source software:

Architecture of Nhost




Visit https://docs.nhost.io for the complete documentation.

Get Started

Option 1: Nhost Hosted Platform

  1. Sign in to Nhost.
  2. Create Nhost app.
  3. Done.

Option 2: Self-hosting

Since Nhost is 100% open source, you can self-host the whole Nhost stack. Check out the example docker-compose file to self-host Nhost.

Sign In and Make a Graphql Request

Install the @nhost/nhost-js package and start build your app:

import { NhostClient } from '@nhost/nhost-js'

const nhost = new NhostClient({
  subdomain: '<your-subdomain>',
  region: '<your-region>'
})

await nhost.auth.signIn({ email: '[email protected]', password: 'spaceX' })

await nhost.graphql.request(`{
  users {
    id
    displayName
    email
  }
}`)

Frontend Agnostic

Nhost is frontend agnostic, which means Nhost works with all frontend frameworks.

Resources

  • Start developing locally with the Nhost CLI

Nhost Clients

Integrations

Applications

Community ❤️

First and foremost: Star and watch this repository to stay up-to-date.

Also, follow Nhost on GitHub Discussions, our Blog, and on Twitter. You can chat with the team and other members on Discord and follow our tutorials and other video material at YouTube.

Nhost is Open Source

This repository, and most of our other open source projects, are licensed under the MIT license.

ROSS Index - Fastest Growing Open-Source Startups | Runa Capital

How to contribute

Here are some ways of contributing to making Nhost better:

Contributors

A table of avatars from the project's contributors

react-auth's People

Contributors

elitan avatar guicurcio avatar nunopato avatar plmercereau avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

cezarneaga dohomi

react-auth's Issues

The useNhostAuth hook returning wrong value

Hi! I just tried the new version 2. I noticed the useNhostAuth hook returning value isAuthenticated true, while im never logged in (tried in private browser). But when im using auth.isAuthenticated() from nhost-js-sdk it was false. I dont know if it is intended or not.

const nhost = useNhostAuth();
console.log(
"🚀 ~ file: User.tsx ~ line 94 ~ useNhostAuthEnchanced ~ from useNhostAuth hook",
nhost
);
const isAuthenticated = auth.isAuthenticated();
console.log(
"🚀 ~ file: User.tsx ~ line 102 ~ useNhostAuthEnchanced ~ from nhost-js-sdk auth.isAuthenticated()",
isAuthenticated
);
const getJWTToken = auth.getJWTToken();
console.log(
"🚀 ~ file: User.tsx ~ line 104 ~ useNhostAuthEnchanced ~ from nhost-js-sdk auth.getJWTToken",
getJWTToken
);

2021-10-23-182449_3286x1080_scrot (1)

Next.js "PrivateRoute" issue

Following on from nhost/react-apollo#4

With the current setup, the <NHostAuthProvider> component requires Next.js users to wrap any pages where they are using useQuery, useMutation or useSubscription with a PrivateRoute HOC (e.g https://github.com/nhost-examples/nextjs-apollo/blob/main/components/private-route.jsx)

Currently this component is only available in the Nhost examples. One option could be to export the PrivateRoute component directly from @nhost/react-auth

However, I think this still leads to a not great developer experience, because it requires wrapping the pages in the HOC every time

@elitan raised the point on the other issue:

I think the reason why official Next.js + Apollo examples does not use a similar PrivateRoute approach is because it does not handle auth.

I am not 100% sure, but I think it's definitely possible to handle auth + Apollo with Next.js, without the wrapper approach (see this official example)

If we want to keep the HOC strategy, I also agree that the name PrivateRoute could be improved. Maybe AuthProtected or WithAuthProtection 🤷‍♂️

user prop always null when using useNhostAuth hook

While using a component inside the NhostAuthProvider and using const { user } = useNhostAuth() the user is always null.

I can login and the isAuthenticated is true but the user is null.

@nhost/react-auth 2.0.3

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.