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

afterCallback Hook [SDK-1728] #171

Merged
merged 3 commits into from
Dec 22, 2020
Merged

afterCallback Hook [SDK-1728] #171

merged 3 commits into from
Dec 22, 2020

Conversation

davidpatrick
Copy link
Contributor

This PR introduces an afterCallback to allow the user to cover the following usecases:

  1. Validating additional Claims in the ID token

Given I configure an organisation in Auth0 org_abc123, when I login with the SDK, then I can verify the org_id claim that it equals org_abs123, and if it is successful I can finish the login, and if it fails I can fail the login with a 401

  1. Adding additional profile information from /userinfo

Given my id_token does not contain all my profile claims, when I login, then I can fetch extra claims from /userinfo, and I can add them to the session

* Function for custom callback handling after receiving tokens and before redirecting
* This can be used for handling token storage, making userinfo calls, claim validation, throwing errors, etc
Copy link
Contributor

@adamjmcgrath adamjmcgrath left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, couple of comments

middleware/auth.js Outdated Show resolved Hide resolved
index.d.ts Outdated Show resolved Hide resolved
@adamjmcgrath adamjmcgrath requested a review from panva December 17, 2020 10:39
@adamjmcgrath
Copy link
Contributor

@panva what do you think of the name? (and do you have any other comments)

the next SDK calls it onUserLoaded - I'll change it to match whatever we decide for this sdk

index.d.ts Outdated Show resolved Hide resolved
@panva
Copy link
Contributor

panva commented Dec 17, 2020

@panva what do you think of the name? (and do you have any other comments)

the next SDK calls it onUserLoaded - I'll change it to match whatever we decide for this sdk

I am indifferent as to what to name this.

@adamjmcgrath adamjmcgrath merged commit 4839c97 into master Dec 22, 2020
@adamjmcgrath adamjmcgrath deleted the afterCallbackHook branch December 22, 2020 17:39
@davidpatrick davidpatrick added this to the v2.2.0 milestone Jan 4, 2021
davidpatrick added a commit that referenced this pull request Jan 13, 2021
**Added**
- afterCallback Hook [#168](#168) ([davidpatrick](https://github.com/davidpatrick))

**Changed**
- Move transient cookies into single cookie [#171](#171) ([davidpatrick](https://github.com/davidpatrick))
@davidpatrick davidpatrick mentioned this pull request Jan 13, 2021
davidpatrick added a commit that referenced this pull request Jan 14, 2021
**Added**
- afterCallback Hook [#168](#168) ([davidpatrick](https://github.com/davidpatrick))

**Changed**
- Move transient cookies into single cookie [#171](#171) ([davidpatrick](https://github.com/davidpatrick))
davidpatrick added a commit that referenced this pull request Jan 14, 2021
**Added**
- afterCallback Hook [#168](#168) ([davidpatrick](https://github.com/davidpatrick))

**Changed**
- Move transient cookies into single cookie [#171](#171) ([davidpatrick](https://github.com/davidpatrick))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants