Class: ClientOAuth2Provider
Isolated
Represents the client OAuth2 provider, which is used to generate OAuth2 access tokens using the configured OAuth2 token endpoint configurations. This supports the client credentials grant type, password grant type, refresh token grant type, and the JWT bearer grant type.
- Client Credentials Grant Type
1oauth2:ClientOAuth2Provider provider = new({2 tokenUrl: "https://localhost:9445/oauth2/token",3 clientId: "3MVG9YDQS5WtC11paU2WcQjBB3L",4 clientSecret: "9205371918321623741",5 scopes: ["token-scope1", "token-scope2"]6});
- Password Grant Type
1oauth2:ClientOAuth2Provider provider = new({2 tokenUrl: "https://localhost:9445/oauth2/token",3 username: "johndoe",4 password: "A3ddj3w",5 clientId: "3MVG9YDQS5WtC11paU2WcQjBB3L",6 clientSecret: "9205371918321623741",7 scopes: ["token-scope1", "token-scope2"]8});
- Refresh Token Grant Type
1oauth2:ClientOAuth2Provider provider = new({2 refreshUrl: "https://localhost:9445/oauth2/token",3 refreshToken: "XlfBs91yquexJqDaKEMzVg==",4 clientId: "3MVG9YDQS5WtC11paU2WcQjBB3L",5 clientSecret: "9205371918321623741",6 scopes: ["token-scope1", "token-scope2"]7});
Constructor
Provides authorization based on the provided OAuth2 configurations.
init (GrantConfig grantConfig)
- grantConfig GrantConfig
OAuth2 grant type configurations
Methods
generateToken | Get an OAuth2 access token from the token endpoint. |