Determining User Authentication Method in FusionAuth
-
In our application, we want to determine how a user authenticated—whether via Google login, username/password, IDP, etc.
Questions:
- Is this information already included in the JWT?
- If not, is there a way to receive this data when a user logs in?
-
Yes, FusionAuth provides this information via the authenticationType claim in the JWT. This claim indicates the authentication method used, such as PASSWORD, GOOGLE, SAML, etc.
How to Access Authentication Type:
- From the JWT:
- The authenticationType claim is included in the JWT access token.
- Documentation: JWT Access Token Claims
- From a Webhook Event (Alternative Approach):
- The same authenticationType value is included in the user.login.success webhook event.
- This may be useful if your system processes authentication events via webhooks instead of decoding JWTs.
- Documentation: User Login Success Webhook
For additional details on JWT structure and claims, refer to: JWT Components Explained
- From the JWT:
-