Skip to content

Commit 367b593

Browse files
committed
Domain sync
1 parent 3f1d4f3 commit 367b593

File tree

1 file changed

+37
-1
lines changed

1 file changed

+37
-1
lines changed

src/FusionAuthClient.ts

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -901,7 +901,7 @@ export class FusionAuthClient {
901901

902902
/**
903903
* Exchanges an OAuth authorization code for an access token.
904-
* If you will be using the Authorization Code grant, you will make a request to the Token endpoint to exchange the authorization code returned from the Authorize endpoint for an access token.
904+
* Makes a request to the Token endpoint to exchange the authorization code returned from the Authorize endpoint for an access token.
905905
*
906906
* @param {string} code The authorization code returned on the /oauth2/authorize response.
907907
* @param {string} client_id The unique client identifier. The client Id is the Id of the FusionAuth Application in which you you are attempting to authenticate.
@@ -924,6 +924,33 @@ export class FusionAuthClient {
924924
.go();
925925
}
926926

927+
/**
928+
* Exchanges an OAuth authorization code and code_verifier for an access token.
929+
* Makes a request to the Token endpoint to exchange the authorization code returned from the Authorize endpoint and a code_verifier for an access token.
930+
*
931+
* @param {string} code The authorization code returned on the /oauth2/authorize response.
932+
* @param {string} client_id (Optional) The unique client identifier. The client Id is the Id of the FusionAuth Application in which you you are attempting to authenticate. This parameter is optional when the Authorization header is provided.
933+
* @param {string} client_secret (Optional) The client secret. This value may optionally be provided in the request body instead of the Authorization header.
934+
* @param {string} redirect_uri The URI to redirect to upon a successful request.
935+
* @param {string} code_verifier The random string generated previously. Will be compared with the code_challenge sent previously, which allows the OAuth provider to authenticate your app.
936+
* @returns {Promise<ClientResponse<AccessToken>>}
937+
*/
938+
exchangeOAuthCodeForAccessTokenUsingPKCE(code: string, client_id: string, client_secret: string, redirect_uri: string, code_verifier: string): Promise<ClientResponse<AccessToken>> {
939+
let body = new URLSearchParams();
940+
941+
body.append('code', code);
942+
body.append('client_id', client_id);
943+
body.append('client_secret', client_secret);
944+
body.append('grant_type', 'authorization_code');
945+
body.append('redirect_uri', redirect_uri);
946+
body.append('code_verifier', code_verifier);
947+
return this.startAnonymous<AccessToken, OAuthError>()
948+
.withUri('/oauth2/token')
949+
.withFormData(body)
950+
.withMethod("POST")
951+
.go();
952+
}
953+
927954
/**
928955
* Exchange a Refresh Token for an Access Token.
929956
* If you will be using the Refresh Token Grant, you will make a request to the Token endpoint to exchange the user’s refresh token for an access token.
@@ -3568,6 +3595,9 @@ export enum Algorithm {
35683595
HS256 = "HS256",
35693596
HS384 = "HS384",
35703597
HS512 = "HS512",
3598+
PS256 = "PS256",
3599+
PS384 = "PS384",
3600+
PS512 = "PS512",
35713601
RS256 = "RS256",
35723602
RS384 = "RS384",
35733603
RS512 = "RS512",
@@ -5962,6 +5992,7 @@ export interface SAMLv2Configuration extends Enableable {
59625992
logoutURL?: string;
59635993
requireSignedRequests?: boolean;
59645994
xmlSignatureC14nMethod?: CanonicalizationMethod;
5995+
xmlSignatureLocation?: XMLSignatureLocation;
59655996
}
59665997

59675998
/**
@@ -6965,3 +6996,8 @@ export interface WebhookResponse {
69656996
webhooks?: Array<Webhook>;
69666997
}
69676998

6999+
export enum XMLSignatureLocation {
7000+
Assertion = "Assertion",
7001+
Response = "Response"
7002+
}
7003+

0 commit comments

Comments
 (0)