Search on google for [Oracle APEX with two factor authentication] and you will find almost no documentation on how to implement this. The documentation which is available gives you only bits and pieces.
I have made a document in which I describe the way I have set it up in my application. In order to do so I have googled and combined the works others have done. In a way this document is thus no more than combining all the spread documentation.
So first of all I would like to thank the people who are much smarter than me and whose work I have copied and used.
Below are the links which I have used in order to setup the authentication in my application. Read them so you will have a better understanding of the way two factor authentication works.
First a blog by Storm Petrel on how to use sms as two factor authentication:
https://www.google.nl/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0ahUKEwjCsqXv4JPYAhWMKFAKHUmIDRsQFgg6MAA&url=http%3A%2F%2Fstorm-petrel.com%2Forablog%2F2015%2F11%2F29%2Foracle-apex-multifactor-authentication.html&usg=AOvVaw0fJ97wYhLef1fBKjzSdZF-
Second the post on Oracle community by Rabbit (user528481). In this post he provided the blue print for the authentication code on application site.
https://www.google.nl/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0ahUKEwiwytjE5JPYAhXLL1AKHXSgDzsQFggnMAA&url=https%3A%2F%2Fcommunity.oracle.com%2Fthread%2F3905510&usg=AOvVaw3xueL1RGsEpK1J2txzYYu0
Third a post by APEX Ninjas about redirecting the homepage:
http://www.apexninjas.com/blog/2011/03/set-first-page-of-the-application-dynamically-for-applications-that-require-authentication/
Fourth a post on Stack overflow by Mark J. Bobak about setting up the QR-code for the authenticator app on your phone:
https://stackoverflow.com/questions/34520928/how-to-generate-a-qr-code-for-google-authenticator-that-correctly-shows-issuer-d
Fifth a post by PSOUG.org about converting decimal to binary code:
http://psoug.org/snippet/Convert-between-Decimal-Binary-Octal-and-Hex_536.htm
Without the work these people have done and generously shared, this document was never written.
I hope this document helps everyone who struggles with two factor authentication as I did.
And if anyone have improvements I very much like to hear them!
With kind regards,
Marco