Git Product home page Git Product logo

clerk-rs's Issues

Feature flag for rustls/native-tls

The current default feature on reqwest uses native TLS which is harder to compile on some platforms.

It could either be switched to use rustls by default with a flag for native, or simply a flag for enabling rustls.

azp claim should be optional

The azp claim may not always exist on the Clerk JWT. From the Clerk docs:

azp: authorized party - the Origin header that was included in the original Frontend API request made from the user. Most commonly, it will be the URL of the application. For example: https://example.com. This claim could be omitted if, for privacy-related reasons, Origin is empty or null.

This causes an error when decoding the JWT because azp is required in ClerkJwt: Error(Json(Error("missing field `azp`", line: 1, column: 185))).

Cache JWKS

When authorizing requests, instead of getting the JWKS from Clerk on every request, there should be some mechanism to cache the JWKS. clerk-rs could provide some common options (cached in memory, refresh on unknown kid, refresh periodically) and reasonable defaults and a trait to allow custom implementations.

Timestamps should be `i64` and not `i32`

Based on the documentation, Clerk seems to use i64 for timestamps.

After briefly reviewing the codebase, I've identified several instances of i32 timestamps:

Incorrect type/struct

found a bug in the get_user function. Here is a snippet of the actual response from clerk:

...
"totp_enabled": false,
"backup_code_enabled": false,
"email_addresses": [
{
"id": "idn_xyz",
"object": "email_address",
"email_address": "[email protected]",
"reserved": false,
"verification": {
"status": "verified",
"strategy": "from_oauth_google",
"attempts": null,
"expire_at": null
},
"linked_to": []
}
],
"phone_numbers": [ ],
...

The value of email_addresses.verification.stratery is "from_oauth_google" however the only allowed value in clerk-rs is Admin - https://docs.rs/clerk-rs/0.1.8/clerk_rs/models/email_address_verification/enum.Strategy.html

Missing `phone_code` and `email_code` verification strategies

I was trying to list all users via clerk_rs::apis::users_api::User::get_user_list, and the response deserialisation failed with this error:

Serde(
    Error(
        "unknown variant `email_code`, expected `admin` or `from_oauth_google`", 
        line: 1, 
        column: 754,
    )
)

Based on the Backend API docs, they have two variants of verification:

OTP Admin
phone_code, email_code admin
image image

I also can't find the from_oauth_google variant.

The clerk_authorize function always checks for an "Authorization" header.

To my understanding, for same-origin requests, authorization headers do not need to be passed because all the information is located in the __session cookie. So clerk_authorize should probably check to see if you have a session cookie or maybe check based off of some sort of configuration.

My assumption is that this will be worked on at some point. Honestly this repo is a godsend, just wondering if I'm correct and that this will be changed or if I have to make own Middleware.

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.