Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • David Armitage 508 posts 2076 karma points
    Dec 03, 2020 @ 01:21
    David Armitage

    Hi Guys,

    Me again. It's been a busy couple of months. It seems to Covet situation may have just helped our industry. Once good thing to take from it I guess.

    I have a client wanting to add 2FA to their Umbraco 8 site. I found this solution that seems to be working well apart from a few small bugs I can probably fix.

    I was thinking there should be a package available by now for this this and I am sure I heard talks about this on Umbra coffee youtube.

    Does anyone know if there is a package for this or if this is getting added into core anytime soon? I have a feeling it is.

    Kind Regards


  • David Armitage 508 posts 2076 karma points
    Dec 03, 2020 @ 03:50
    David Armitage

    Hi Guys,

    I had a good look around and could find any complete packages. Maybe someone will upload something in the future.

    For now I worked with what I mentioned above. It was quite easy to fix up and the bugs are not too challenging.

    Here are the full steps....


    You can download the project and get the new umbraco site up and running very easily and then you will be able to see how 2FA is setup.

    You will need to copy a load of stuff into your project. And also install GoogleAuthentication nuget package.

    You should be copying...

    1. The TwoFactorAuthentication forler

    2. The service and composer cs files

    3. The TwoFactorAuthentication package in the App_Plugins folder

    This should pretty much be it. When you run the project there is a migrations folder which adds a table to the database. I would check that has been added ok.

    This should all work and provide the functionality you need. Here is a list of the bugs....

    Issue 1

    When you login then authenticate there is no redirect to the Umbraco dashboard.

    To fix this find the file.


    And replace: $scope.submit(true); For: window.location.href = '/umbraco';

    $scope.validate = function (provider, code) {
                provider = "GoogleAuthenticator"; //temp netser
                $scope.error2FA = "";
                $scope.code = code;
                authResource.verify2FACode(provider, code)
                    .then(function (data) {
                        window.location.href = '/umbraco';
                    }, function () { $scope.error2FA = "Invalid code entered." });

    Issue 2

    When you enable 2FA for the first time it says invalid code. When you refresh you will see that it works.

    To fix this look for the file


    And replace: if ( === "true")
    For: if ( === true)

    Issue 3

    When you disable the 2FA nothing happens. This is basically the same reason as Issue 2

    To fix this look for the file


    And replace: if ( === "true")
    For: if ( === true)

    There is one more step involved on this one. A double issue.

    Find the file


    And replace: <button type="submit">Disable two step verification</button>
    For: <button ng-click="disable()">Disable two step verification</button>

    Be careful with caching. I find that opening the js and html files in the browser and then force refreshing first before testing will help.

    There is one final issue.

    There is nowhere for administrators to maintain standard users 2FA. I am going to build a custom dashboard for this since I just dont think this was every included into the plugin above.

    Kind Regards


  • andrew shearer 506 posts 653 karma points
    Apr 29, 2021 @ 04:03
    andrew shearer

    hi David - thanks for your summary write up here. Is this still the method you're using or have you since found another package?

  • David Armitage 508 posts 2076 karma points
    Apr 29, 2021 @ 04:27
    David Armitage

    Yes I am still using this method. I actually build a second app over the top of this to improve and add a few extra features.

    I thought the management area was a bit weak so I built a separate management custom section just for the admins.

  • Kevin 5 posts 97 karma points
    Sep 30, 2021 @ 11:31

    Can we use this in Umbraco 9 ?

  • Jay 416 posts 642 karma points
    Feb 25, 2022 @ 09:33

    Was looking for the same thing for Umbraco 9 too. Can't find anything which is weird. There's an implementation in V9.3 but for members. Not sure why there's nothing for Backend User which is weird

  • RhegaF 2 posts 72 karma points
    7 days ago

    Hi david

    can we custom this function authResource.verify2FACode(provider, code) ?

    looks like the authResource is auto generate by umbraco is it?

    also wheres the route of function (PostVerify2FACode) ? i dont get it the routing

Please Sign in or register to post replies

Write your reply to: