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

fix: make clientSecret optional #908

Merged
merged 1 commit into from
Aug 9, 2024
Merged
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
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
Loading