Skip to content

Commit

Permalink
Use the correct parameter name for redirect_uri (#273)
Browse files Browse the repository at this point in the history
* Use the correct parameter name when sending the `redirect_uri` to the API

* Bump version

* Update snapshots for version bump
  • Loading branch information
maxdeviant authored Nov 23, 2020
1 parent 03093a6 commit c2a03a3
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "0.8.2",
"version": "0.8.3",
"name": "@workos-inc/node",
"author": "WorkOS",
"description": "A Node wrapper for the WorkOS API",
Expand Down
2 changes: 1 addition & 1 deletion src/passwordless/passwordless.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ describe('Passwordless', () => {
expect(session.object).toEqual('passwordless_session');

expect(JSON.parse(mock.history.post[0].data).email).toEqual(email);
expect(JSON.parse(mock.history.post[0].data).redirectURI).toEqual(
expect(JSON.parse(mock.history.post[0].data).redirect_uri).toEqual(
redirectURI,
);
expect(mock.history.post[0].url).toEqual('/passwordless/sessions');
Expand Down
12 changes: 8 additions & 4 deletions src/passwordless/passwordless.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@ import { SendSessionResponse } from './interfaces/send-session-response.interfac
export class Passwordless {
constructor(private readonly workos: WorkOS) {}

async createSession(
options: CreatePasswordlessSessionOptions,
): Promise<PasswordlessSession> {
const { data } = await this.workos.post('/passwordless/sessions', options);
async createSession({
redirectURI,
...options
}: CreatePasswordlessSessionOptions): Promise<PasswordlessSession> {
const { data } = await this.workos.post('/passwordless/sessions', {
...options,
redirect_uri: redirectURI,
});
return data;
}

Expand Down
2 changes: 1 addition & 1 deletion src/sso/__snapshots__/sso.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Object {
"Accept": "application/json, text/plain, */*",
"Authorization": "Bearer sk_test_Sz3IQjepeSWaI4cMS4ms4sMuU",
"Content-Type": "application/x-www-form-urlencoded;charset=utf-8",
"User-Agent": "workos-node/0.8.2",
"User-Agent": "workos-node/0.8.3",
}
`;

Expand Down

0 comments on commit c2a03a3

Please sign in to comment.