From 82f769dde39e086116bb9ce8971baf9e7fc52b5a Mon Sep 17 00:00:00 2001 From: pfvatterott Date: Wed, 26 Mar 2025 14:01:59 -0600 Subject: [PATCH] Update README.md --- README.md | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 7b0185b..bf2d72e 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,17 @@ -# PropelAuth +

+ + + +

+ +# PropelAuth Rust Library Add authentication and authorization to your application. This library is meant to be used with a [PropelAuth](https://www.propelauth.com/) account. You can sign up and get started for free. -# Initialize +## Initialize First, you'll need to initialize the library. You can either call `PropelAuth::init` or `PropelAuth::fetch_and_init` (which will fetch any unspecified metadata). @@ -17,7 +23,7 @@ let auth = PropelAuth::fetch_and_init(AuthOptions { }).await.expect("Unable to initialize authentication"); ``` -# Usage / Protecting APIs +## Usage / Protecting APIs - [Axum](#axum) - [Actix](#actix) @@ -40,7 +46,7 @@ let app = Router::new() .layer(auth_layer); // <-- here ``` -You can then take `User` in as an argument, which will look for an [access token](https://docs.propelauth.com/overview/access-token/) in the Authorization header. +You can then take `User` in as an argument, which will look for an [access token](https://docs.propelauth.com/guides-and-examples/guides/access-tokens) in the Authorization header. ```rust // User will automatically return a 401 (Unauthorized) if a valid access token wasn't provided @@ -49,7 +55,7 @@ async fn whoami(user: User) -> String { } ``` -You can also check which [organizations](https://docs.propelauth.com/overview/organizations/) the user is in, and which [roles and permissions](https://docs.propelauth.com/overview/rbac/) they have. +You can also check which [organizations](https://docs.propelauth.com/overview/organizations/) the user is in, and which [roles and permissions](https://docs.propelauth.com/overview/authorization/rbac) they have. ```rust // If the user isn't in the provided organization, a 403 is returned @@ -90,7 +96,7 @@ HttpServer::new(move || { }) ``` -You can then take `User` in as an argument, which will look for an [access token](https://docs.propelauth.com/overview/access-token/) in the Authorization header. +You can then take `User` in as an argument, which will look for an [access token](https://docs.propelauth.com/guides-and-examples/guides/access-tokens) in the Authorization header. ```rust // User will automatically return a 401 (Unauthorized) if a valid access token wasn't provided @@ -100,7 +106,7 @@ async fn whoami(user: User) -> impl Responder { } ``` -You can also check which [organizations](https://docs.propelauth.com/overview/organizations/) the user is in, and which [roles and permissions](https://docs.propelauth.com/overview/rbac/) they have. +You can also check which [organizations](https://docs.propelauth.com/overview/organizations/) the user is in, and which [roles and permissions](https://docs.propelauth.com/overview/authorization/rbac) they have. ```rust // If the user isn't in the provided organization, a 403 is returned @@ -136,7 +142,7 @@ propelauth = { version >= "0.12.1", features = ["rustls"], default-features = fa ## Other -After initializing `auth`, you can verify [access tokens](https://docs.propelauth.com/overview/access-token/) by passing in the Authorization header (formatted `Bearer TOKEN`): +After initializing `auth`, you can verify [access tokens](https://docs.propelauth.com/guides-and-examples/guides/access-tokens) by passing in the Authorization header (formatted `Bearer TOKEN`): ```rust let result = auth.verify().validate_authorization_header(&authorization_header); @@ -145,7 +151,7 @@ match result { Err(_) => { /* invalid access token, typically we return a 401 Unauthorized here */ } } ``` -You can also check which [organizations](https://docs.propelauth.com/overview/organizations/) the user is in, and which [roles and permissions](https://docs.propelauth.com/overview/rbac/) they have. +You can also check which [organizations](https://docs.propelauth.com/overview/organizations/) the user is in, and which [roles and permissions](https://docs.propelauth.com/overview/authorization/rbac) they have. ```rust let org = auth.validate_org_membership( @@ -163,7 +169,7 @@ let org = user.validate_org_membership( And finally, you can make API calls directly from `auth.user()` and `auth.org()` -# Where do the access tokens come from? +## Where do the access tokens come from? They come from your frontend. -You can read more about integrating your frontend [here](https://docs.propelauth.com/getting-started/frontend-integration/). +You can read more about integrating your frontend [here](https://docs.propelauth.com/getting-started/quickstart-fe).