Skip to content

Commit

Permalink
refactor: remove oauth scope for publisher auth code (#1450)
Browse files Browse the repository at this point in the history
  • Loading branch information
colorfield authored Nov 1, 2023
1 parent cddd055 commit 1f6fd7e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
1 change: 1 addition & 0 deletions packages/npm/@amazeelabs/publisher/publisher.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export default defineConfig({
oAuth2: {
clientId: process.env.OAUTH2_CLIENT_ID || 'publisher',
clientSecret: process.env.OAUTH2_CLIENT_ID || 'publisher',
// Applies for ResourceOwnerPassword only.
scope: process.env.OAUTH2_SCOPE || 'publisher',
tokenHost: process.env.OAUTH2_TOKEN_HOST || 'http://127.0.0.1:8888',
tokenPath: process.env.OAUTH2_TOKEN_PATH || '/oauth/token',
Expand Down
7 changes: 1 addition & 6 deletions packages/npm/@amazeelabs/publisher/src/core/tools/oAuth2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,6 @@ export const getOAuth2AuthorizeUrl = (
return client.authorizeURL({
// Set on the OAuth2 provider.
//redirect_uri: callbackUrl,
scope: oAuth2Config.scope,
// https://auth0.com/docs/secure/attack-protection/state-parameters
state: encodedState,
});
Expand Down Expand Up @@ -320,11 +319,7 @@ export const isAuthenticated = async (req: Request): Promise<boolean> => {
result = true;
} else {
try {
const refreshParams = {
grant_type: 'refresh_token',
scope: oAuth2Config.scope,
};
accessToken = await accessToken.refresh(refreshParams);
accessToken = await accessToken.refresh();
persistAccessToken(accessToken, req);
result = true;
} catch (error) {
Expand Down

0 comments on commit 1f6fd7e

Please sign in to comment.