Updates for SECOAUTH refactor

Updates our code to fix several issues, using the refactored SECOAUTH code from my fork.