Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PaymentRequired to AuthResult #1832

Open
LukeTemp opened this issue Jan 29, 2024 · 0 comments
Open

Add PaymentRequired to AuthResult #1832

LukeTemp opened this issue Jan 29, 2024 · 0 comments

Comments

@LukeTemp
Copy link
Contributor

The AuthResult datatype offers the Unauthorized constructor, which logically corresponds to a 403 error, but there is no constructor that implies a user lacks the necessary subscription/license for a feature - a 402 error: payment required.

This would be a useful constructor for any proprietary software with paywalled features as 402 and 403 status codes could be handled differently, making it clear to users when a feature isn't available to them (e.g., because of their role) or when a feature is paywalled.

Implementing paywalling like this, at the Authentication level, would give devs control over when to show a paywall and when to show a 'permission denied' page (e.g., if the user lacks a subscription and lacks the required role for a feature, then the spec may be to show them a paywall over showing them the permission denied page, or vice versa). This would also prevent situations where, if a user was to be shown a paywall over a permission denied page, they would need to be authenticated initially (to see the paywall) but unauthenticated on acquiring the necessary subscription for the feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant