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

chore: correct parseFromUrl signature in type definitions (#763 copy) #853

Closed
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

- [#852](https://github.com/okta/okta-auth-js/pull/852) Skips non-successful requests cacheing

### Other

- [#853](https://github.com/okta/okta-auth-js/pull/853) Updates `token.parseFromUrl` signature (adds optional parameter)

## 5.2.0

### Features
Expand Down
2 changes: 1 addition & 1 deletion lib/types/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export interface ParseFromUrlOptions {
responseMode?: string;
}

export type ParseFromUrlFunction = () => Promise<TokenResponse>;
export type ParseFromUrlFunction = (options?: string | ParseFromUrlOptions) => Promise<TokenResponse>;

export interface ParseFromUrlInterface extends ParseFromUrlFunction {
_getDocument: () => Document;
Expand Down
26 changes: 26 additions & 0 deletions test/types/parseFromUrl.test-d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*!
* Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.
* The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
*
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
* See the License for the specific language governing permissions and limitations under the License.
*
*/

import {
OktaAuth, TokenResponse
} from '@okta/okta-auth-js';
import { expectType } from 'tsd';

const authClient = new OktaAuth({});
(async () => {
expectType<TokenResponse>(await authClient.token.parseFromUrl());
expectType<TokenResponse>(await authClient.token.parseFromUrl({
url: 'http://org.com?token',
responseMode: 'query'
}));
})();