Skip to content

OAuth2 And SSO ​

Page Guide ​

ScenarioFor projects that integrate FastBee with a unified identity system, third-party login, or OAuth2 service mode.
PrerequisiteClient, callback URI, scope, user mapping, and logout strategy have been planned.
AcceptanceThe third-party system can authorize, obtain token, read user information, and log out according to the expected policy.

1. Capability Scope ​

FastBee OAuth/SSO is provided by fastbee-plugs/fastbee-oauth-server.

CapabilityAPI Or PathDescription
Authorization/oauth2/authorize, /oauth/authorizeAuthorization code entry.
Token/oauth2/token, /oauth/tokenObtain access token.
Login confirmation/oauth2/doLogin, /oauth2/doConfirmLogin and authorization confirmation.
Token check/oauth2/check-token, /oauth/check_tokenValidate token.
Token revoke/oauth2/revoke, /oauth/revokeLogout or revoke authorization.
User info/oauth2/userinfoGet current user profile.
OIDC metadata/.well-known/openid-configurationOpenID Connect metadata.
JWKS/oauth2/jwksPublic key information.
SSO/sso/*Single sign-on related APIs.

2. Client Configuration ​

FieldDescriptionRecommendation
Client IDUnique client identifier.Use a short business system code.
Client SecretClient credential.Rotate regularly in production.
Redirect URIAuthorization callback address.Must match the third-party configuration exactly.
ScopeAuthorization range.Open only the minimum required scope.
Grant TypeAuthorization mode.Authorization code is commonly used.
Token lifetimeAccess token validity period.Configure according to security requirements.
Refresh TokenWhether refresh is allowed.Enable for long-session scenarios.

3. Authorization Code Flow ​

4. Integration Checks ​

Check ItemExpected Result
Callback URIUser returns to the third-party system after authorization.
CodeCallback contains an authorization code.
TokenThird-party system obtains access token successfully.
User info/userinfo returns the current user profile.
ScopeGranted scope matches client configuration.
LogoutFastBee and third-party logout policies are clear.
AuditLogin and authorization logs are traceable.

5. FAQ ​

redirect_uri mismatch ​

The callback address must exactly match the client configuration, including protocol, domain, port, path, and trailing slash.

Token request fails ​

Check the Client ID, Client Secret, whether the authorization code has expired, and whether the grant type is enabled.

User information is empty ​

Check whether the token is valid, whether the user is disabled, and whether the scope includes permission to read user information.

Incomplete single logout ​

Decide whether to log out of only the third-party system, only FastBee, or both. Each project should define a consistent policy.

6. Development Entry ​

TypePath Or APIDescription
Frontend pagevue3/src/views/iot/clientDetails, vue3/src/views/system/sysclientClient configuration.
OAuth modulespringboot/fastbee-plugs/fastbee-oauth-serverOAuth2 and SSO service.
Client API/iot/clientDetailsClient management.
OAuth tablesoauth_client_details, oauth_access_token, oauth_refresh_tokenAuthorization data.
User tablessys_user, sys_auth_userUser and third-party identity mapping.

FastBee | fastbee.cn