如何使用 oauth2 客户端应用程序指定范围

how to specify the scope with oauth2 client application

我正在使用 Spring 安全 OAuth2 客户端应用程序并提供了以下配置


spring:
  security:
    oauth2:
      client:
        registration:
          okta:
            client-id: 
            client-secret: 
            scope: openid
        provider:
          okta:
            authorization-uri: https://dev-7858070.okta.com/oauth2/default/v1/authorize
            token-uri: https://dev-7858070.okta.com/oauth2/default/v1/token
            user-info-uri: https://dev-7858070.okta.com/oauth2/default/v1/userinfo
            jwk-set-uri: https://dev-7858070.okta.com/oauth2/default/v1/keys

我已将范围指定为仅 openid,但仍然得到其他范围,如 profileemail。我只想获得 openid 范围。我哪里错了?

您可以指定多个范围,用逗号分隔它们。

spring:
  security:
    oauth2:
      client:
        registration:
          okta:
            client-id: 
            client-secret: 
            scope: openid,profile,email