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

feat: support RFC 8693 token exchange #112

Merged
merged 4 commits into from
Mar 7, 2024
Merged

Conversation

jasonraimondi
Copy link
Owner

Description

Support OAuth 2.0 Token Exchange specification (RFC 8693). This allows clients to exchange one type of token for another, facilitating more complex authorization scenarios and secure delegation.

Usage

Enable the grant with a processTokenExchangeFn.

authorizationServer.enableGrant({
  grant_type: "urn:ietf:params:oauth:grant-type:token-exchange",
  processTokenExchangeFn: (args: ProcessTokenExchangeArgs): Promise<OAuthUser | undefined> => {
    const { 
      resource,
      audience,
      scopes,
      requestedTokenType,
      subjectToken,
      subjectTokenType,
      actorToken,
      actorTokenType,
    } = args;
    // handle token exchange with third party service
    const user = getUser();
    return user;
  };
})

Issue

Resolves #111

@Jazcash
Copy link

Jazcash commented Mar 6, 2024

Have checked this out locally and tested against my server and it works a treat 👍

@jasonraimondi
Copy link
Owner Author

Have checked this out locally and tested against my server and it works a treat 👍

Awesome thank you for testing. I'll write some docs later this evening and I'll post an official release.

@jasonraimondi jasonraimondi merged commit 9d0cf87 into main Mar 7, 2024
5 checks passed
@jasonraimondi jasonraimondi deleted the feat/token-exchange branch March 7, 2024 03:09
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

Successfully merging this pull request may close these issues.

Support RFC 8693 - Token Exchange
2 participants