Skip to content

Adding resend and cloudflare as Oauth providerΒ #13347

Closed

Description

@imtia33

πŸ”– Enhancement description

Cloudflare

Via Cloudflare Zero Trust β†’ SaaS application β†’ Generic OIDC. Standard OIDC: /authorization, /token, /userinfo endpoints, scopes openid email profile, returns sub/email/name.
endpoints are per-tenant + per-client (https://{team}.cloudflareaccess.com/cdn-cgi/access/sso/oidc/{clientId}/...), not global. The OAuth2 base class only has slots for appId + appSecret, so we'll store the team name inside appSecret as a JSON blob ({"clientSecret":"...","team":"..."}) β€” same pattern Microsoft uses for tenantID.

Resend β€” needs two calls

Via Resend OAuth 2.1 + PKCE . Endpoints: /oauth/authorize, /oauth/token, /oauth/revoke, plus /oauth/register for Dynamic Client Registration.

🎀 Pitch

Two things need your sign-off:

1: No /userinfo β€” decode the JWT instead?

Resend has no /userinfo endpoint and no id_token. The only place user identity lives is inside the access_token JWT (typ: at+jwt, RFC 9068, signed ES256). To get the user ID we'd base64-decode the JWT payload and read sub β€” without verifying the signature.

RFC 9068 says clients shouldn't inspect access tokens. We're ok with it because:

  • Token arrives over TLS from api.resend.com/oauth/token directly
  • We never use it for downstream calls β€” just read sub for identity
  • Existing providers (Kick) already do JWT inspection

This part is kind of necessary for resend.

Another Question:

Resend supports public (token_endpoint_auth_method: "none", PKCE only) and confidential (client_secret_basic or client_secret_post) clients. We want confidential so we can reuse the standard verifyCredentials() pattern from the HuggingFace PR #13123 (Basic auth header + invalid code β†’ invalid_client means bad creds, invalid_grant means good creds).
Confirm?
You can confirm the findings from these ref:

πŸ‘€ Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

🏒 Have you read the Code of Conduct?

Activity

  1. added
    product / auth
    product / messaging
    product / storage
    sdk / cli
    on Aug 25, 2026
  2. imtia33 commented on Aug 25, 2026

    @imtia33
    ContributorAuthor

    Ignore Q1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

product / authproduct / messagingproduct / storagesdk / cli

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions