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 SP Initiated Auth #1113

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 6.2.0

### Features

- [#1113](https://github.com/okta/okta-auth-js/pull/1113) Updates types for `SigninWithCredentialsOptions` and `SignInOptions` to support `SP Initiated Auth`

## 6.1.0

### Features
Expand Down
6 changes: 3 additions & 3 deletions lib/types/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,16 +239,16 @@ export interface SigninOptions extends
deviceToken?: string;
};
sendFingerprint?: boolean;
stateToken?: string;
}

export interface SigninWithRedirectOptions extends SigninOptions, TokenParams {
originalUri?: string;
}

export interface SigninWithCredentialsOptions extends SigninOptions {
// Require a username and password
username: string;
password: string;
username?: string;
password?: string;
}

export interface SigninAPI {
Expand Down
5 changes: 5 additions & 0 deletions test/spec/OktaAuth/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@ describe('OktaAuth (api)', function() {
headers: { 'X-Device-Fingerprint': 'fake fingerprint' }
});
});
it('can pass stateToken to /authn endpoint', async () => {
options = { stateToken: 'fake-stateToken' };
await auth.signInWithCredentials(options);
expect(postToTransaction).toHaveBeenCalledWith(auth, '/api/v1/authn', options, undefined);
});
});

describe('signIn', () => {
Expand Down
3 changes: 2 additions & 1 deletion test/types/auth.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ const authorizeOptions2: TokenParams = {
sendFingerprint: true,
context: {
deviceToken: 'device-1'
}
},
stateToken: 'fake-state-token'
}));
expectType<void>(await authClient.signInWithRedirect());
expectType<void>(await authClient.signInWithRedirect({
Expand Down