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

[SDK-2273] Add onRedirecting login hook #1157

Merged
merged 18 commits into from
Mar 18, 2021
Merged

Conversation

stevehobbsdev
Copy link
Contributor

@stevehobbsdev stevehobbsdev commented Mar 11, 2021

Changes

This PR adds a hook function to WebAuth.login and WebAuth.passwordlessLogin that would enable a developer to handle the event where a login ticket has been retrieved, just before redirecting away to the /authorize endpoint.

The hook is a function that can be specified, where the done function that is given must be called when the hook is complete, to let the SDK know that it can resume with authentication.

Usage example:

webAuth.login({
  username: 'username',
  password: 'password',
  onRedirecting: function(done) {
    // Your hook code here
    done();  // call this when finished
  }
}, function(err, res) {
});

Same for passwordless:

webAuth.passwordlessLogin({
    connection: 'email',
    verificationCode: 'code',
    email: 'email',
    onRedirecting: function(done) {
      // Your hook code here
      done();   // call this when finished
    }
  },
  function (err, res) {
  }
);

This PR also includes:

  • Doc comments updates
  • Readme formatting updates across the board
  • A new playground script to quickly test out this feature for login and passwordless

Testing

  • This change adds unit test coverage
  • This change adds integration test coverage

Checklist

@stevehobbsdev stevehobbsdev added enhancement An enhancement or improvement to the SDK that could not be otherwise categorized as a new feature CH: Added review:medium Medium review labels Mar 11, 2021
@stevehobbsdev stevehobbsdev added this to the vNext milestone Mar 11, 2021
@stevehobbsdev stevehobbsdev requested a review from a team as a code owner March 11, 2021 16:28
src/web-auth/hosted-pages.js Show resolved Hide resolved
src/web-auth/cross-origin-authentication.js Show resolved Hide resolved
src/web-auth/index.js Show resolved Hide resolved
src/web-auth/cross-origin-authentication.js Show resolved Hide resolved
@stevehobbsdev stevehobbsdev merged commit 66751da into master Mar 18, 2021
@stevehobbsdev stevehobbsdev deleted the sdk-2273/success-login branch March 18, 2021 10:20
@stevehobbsdev stevehobbsdev mentioned this pull request Mar 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CH: Added enhancement An enhancement or improvement to the SDK that could not be otherwise categorized as a new feature review:medium Medium review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants