Skip to content
This repository was archived by the owner on Feb 14, 2023. It is now read-only.
This repository was archived by the owner on Feb 14, 2023. It is now read-only.

basePropTypes: clientSecret is unnecessarily required #4

Description

@npflood

It is not recommended to use client secrets in single page apps.

Single-page apps (or browser-based apps) run entirely in the browser after loading the Javascript and HTML source code from a web page. Since the entire source is available to the browser, they cannot maintain the confidentiality of a client secret, so the secret is not used for these apps. The flow is exactly the same as the authorization code flow, but at the last step, the authorization code is exchanged for an access token without using the client secret.

From: https://www.oauth.com/oauth2-servers/single-page-apps/

The basePropTypes currently states that the clientSecret is required:

const basePropTypes = {
  oauthClient: PropTypes.shape({
    options: PropTypes.shape({
      clientId: PropTypes.string.isRequired,
      clientSecret: PropTypes.string.isRequired,
      redirectUri: PropTypes.string.isRequired,
      authorizationUri: PropTypes.string.isRequired,
      accessTokenUri: PropTypes.string.isRequired,
    }),
    code: PropTypes.shape({
      getToken: PropTypes.func.isRequired,
    }),
  }),
};

As this requirement is contrary to best practices in some situations, and the client secret is not required according to Oauth2 specifications, I suggest that the ".isRequired" flag be removed from the propTypes declaration.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions