Skip to content

Commit

Permalink
fix: make clientSecret optional
Browse files Browse the repository at this point in the history
  • Loading branch information
anku255 committed Aug 9, 2024
1 parent 611d860 commit d21f2cf
Show file tree
Hide file tree
Showing 10 changed files with 6 additions and 16 deletions.
2 changes: 1 addition & 1 deletion lib/build/recipe/oauth2client/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export declare type UserInfo = {
};
export declare type ProviderConfigInput = {
clientId: string;
clientSecret: string;
clientSecret?: string;
oidcDiscoveryEndpoint: string;
};
export declare type ProviderConfigWithOIDCInfo = ProviderConfigInput & {
Expand Down
3 changes: 0 additions & 3 deletions lib/build/recipe/oauth2client/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ function validateAndNormaliseUserInput(_appInfo, config) {
// `Only Supertokens OAuth ClientIds are supported in the OAuth2Client recipe. For any other OAuth Clients use the thirdparty recipe.`
// );
// }
if (config.providerConfig.clientSecret === undefined) {
throw new Error("Please pass clientSecret argument in the OAuth2Client providerConfig.");
}
if (config.providerConfig.oidcDiscoveryEndpoint === undefined) {
throw new Error("Please pass oidcDiscoveryEndpoint argument in the OAuth2Client providerConfig.");
}
Expand Down
2 changes: 1 addition & 1 deletion lib/build/recipe/oauth2provider/OAuth2Client.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export declare class OAuth2Client {
* The secret will be included in the create request as cleartext, and then
* never again. The secret is kept in hashed format and is not recoverable once lost.
*/
clientSecret: string;
clientSecret?: string;
/**
* OAuth 2.0 Client Name
* The human-readable name of the client to be presented to the end-user during authorization.
Expand Down
1 change: 0 additions & 1 deletion lib/build/recipe/oauth2provider/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ class Wrapper {
userContext: utils_1.getUserContext(userContext),
});
}
// TODO: revokeToken
static createTokenForClientCredentials(clientId, clientSecret, scope, audience, userContext) {
return recipe_1.default.getInstanceOrThrowError().recipeInterfaceImpl.tokenExchange({
body: {
Expand Down
2 changes: 1 addition & 1 deletion lib/build/recipe/oauth2provider/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ export declare type APIInterface = {
};
export declare type OAuth2ClientOptions = {
clientId: string;
clientSecret: string;
clientSecret?: string;
createdAt: string;
updatedAt: string;
clientName: string;
Expand Down
2 changes: 1 addition & 1 deletion lib/ts/recipe/oauth2client/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export type UserInfo = {

export type ProviderConfigInput = {
clientId: string;
clientSecret: string;
clientSecret?: string;
oidcDiscoveryEndpoint: string;
};

Expand Down
4 changes: 0 additions & 4 deletions lib/ts/recipe/oauth2client/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ export function validateAndNormaliseUserInput(_appInfo: NormalisedAppinfo, confi
// );
// }

if (config.providerConfig.clientSecret === undefined) {
throw new Error("Please pass clientSecret argument in the OAuth2Client providerConfig.");
}

if (config.providerConfig.oidcDiscoveryEndpoint === undefined) {
throw new Error("Please pass oidcDiscoveryEndpoint argument in the OAuth2Client providerConfig.");
}
Expand Down
2 changes: 1 addition & 1 deletion lib/ts/recipe/oauth2provider/OAuth2Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class OAuth2Client {
* The secret will be included in the create request as cleartext, and then
* never again. The secret is kept in hashed format and is not recoverable once lost.
*/
clientSecret: string;
clientSecret?: string;

/**
* OAuth 2.0 Client Name
Expand Down
2 changes: 0 additions & 2 deletions lib/ts/recipe/oauth2provider/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,6 @@ export default class Wrapper {
});
}

// TODO: revokeToken

static createTokenForClientCredentials(
clientId: string,
clientSecret: string,
Expand Down
2 changes: 1 addition & 1 deletion lib/ts/recipe/oauth2provider/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ export type APIInterface = {

export type OAuth2ClientOptions = {
clientId: string;
clientSecret: string;
clientSecret?: string;
createdAt: string;
updatedAt: string;

Expand Down

0 comments on commit d21f2cf

Please sign in to comment.