GithubHelp home page GithubHelp logo

Comments (6)

panteliselef avatar panteliselef commented on May 27, 2024

Hey @LumDermaku, I quickly wanna mention that not receiving any of org:sys_* permissions from getAuth() is expected. Only your custom permissions should be returned from there.

Thanks for providing us with the reproduction repo. I used both @clerk/remix@3 and the @clerk/remix@beta I could not replicate, posting an image as example below.

image

The reason you were seeing a 401 error with v3 was probably dues not declaring and using the ClerkErrorBoundary

from javascript.

LumDermaku avatar LumDermaku commented on May 27, 2024

Thank you for your reply @panteliselef.
I actually need only custom permissions returned by getAuth(), but still I am not getting the same response like yours, not even orgId, or the default orgPermissions. Maybe something is wrong with Clerk's dev environment? Not sure if my pub key can help.

I have added a custom prop in the session token "{permissions": "{{org_membership.permissions}}"} but I am still getting null for that.

Since getAuth in loaders seem to work for you, is the <Protect> component also working? I am sure my user has the needed permissions since with the client-side useUser() hook I can see all permissions, including the custom ones.

image

For the Error Boundary, I've already tried implementing it but was still having the error. Someone from your team already recommended to upgrade to the latest beta which fixes that issues.

from javascript.

panteliselef avatar panteliselef commented on May 27, 2024

So with clerk, you need to specify an active organization. Easiest way to do this would be to mount the OrganizationSwitcher component and select or create an organization from the UI.

We also have this guide on how to "force" users into an organization, in case your app would only work with a populated orgId. Have a look here

from javascript.

LumDermaku avatar LumDermaku commented on May 27, 2024

@panteliselef the link you provided has a Next.js example, and for this section, there's a server example and client example. Both assume that you get an orgId prop out of the returned object, either from the auth() server function (that looks like the Next.js version of getAuth() for Remix) or from the useAuth() hook.

Either I am doing something wrong with Clerk dashboard setup or the Remix SDK is not working. I even created a custom role now, assigned my custom permission to it; Added a new user to my Org and assigned this custom role to it. Still not getting even an orgId from the server function.
image.

Thank you for your time.

from javascript.

LumDermaku avatar LumDermaku commented on May 27, 2024

@panteliselef I used the <OrganizationList /> and selected the Org i created instead of the personal one. After i clicked it, refreshed the page, now the response from Clerk is looking good in console, just like your response.

Before I begin writing the logic to automatically set one of the orgs as Active by default (this is our case), the docs say that the user will automatically have an org set as Active as soon as they accept the invitation. What type of invitation in this case? Email invites? I didn't accept any email invitations when I added an email of mine to my Org.

There will only be one Custom org that I need some specific users to be part of, and everyone added there should have it set as Active, without having to manually choose an org from our web app since this is kind of a deal breaker.

from javascript.

LumDermaku avatar LumDermaku commented on May 27, 2024

@panteliselef
I think we can somehow mark this as done or closed. For anyone interested in what i did:
I ended up writing that custom logic in a component that gets imported in root.tsx. You can also do it in _index.tsx component because it is rendered within the <Outlet /> of root.tsx.
After the user signs-in, the homepage is loaded and that component does the following:

  1. invokes useOrganizationList() hook.
  2. In a useEffect hook, i check if userMemberships.data array has an element who'se name property is the same as the one i want. I invoke the setActive() function with the org id of the user's membership. Don't forget to add the objects, functions, variables in the dependency array of useEffect.
  3. With a global state manager I set a boolean value which i use to render a button conditionally. In the useEffect hook i also have some custom logic to check whether the global state already has/doesn't have anything set.

from javascript.

Related Issues (20)

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.