8000 Importing users and totp credentials? · keycloak keycloak · Discussion #15334 · GitHub
[go: up one dir, main page]

Skip to content
Discussion options

You must be logged in to vote

For anyone looking at a solution to this problem, see this thread. When migrating credentials, you need to create a new Keycloak endpoint (or have another method of using the Keycloak Admin Client) and then create the credential for a user as follows:

OTPCredentialModel otpCredentialModel = OTPCredentialModel.createTOTP(
        otpSecret, // Migrated TOTP Secret
        6, // Digits
        30, // Period
        "HmacSHA1", // Algorithm
        OTPCredentialModel.SecretEncoding.BASE32.name() // Encoding. This is the important part.
);
new OTPCredentialProvider(session).createCredential(realmModel, userModel, otpCredentialModel);

Replies: 1 comment 10 replies

Comment options

You must be logged in to vote
10 replies
@ryan-morris
Comment options

@darius-m
Comment options

@ryan-morris
Comment options

@angelomelonas
Comment options

Answer selected by ryan-morris
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
0