@@ -656,10 +656,13 @@ import CZitiPrivate
656656
657657 case . CannotContinue:
658658 completed = true
659- let detail = authEvent. detail. isEmpty ? " authentication cannot continue " : authEvent. detail
660- log. error ( " queryProviders: \( detail) " , function: " runQueryProviders() " )
659+ let msg = !authEvent. error. isEmpty ? authEvent. error
660+ : !authEvent. detail. isEmpty ? authEvent. detail
661+ : " authentication cannot continue "
662+ let code = !authEvent. errorCode. isEmpty ? authEvent. errorCode : nil
663+ log. error ( " queryProviders: \( msg) (errorCode= \( code ?? " nil " ) ) " , function: " runQueryProviders() " )
661664 ziti. shutdown ( )
662- cb ( nil , ZitiError ( detail ) )
665+ cb ( nil , ZitiError ( msg , errorCodeString : code ) )
663666
664667 default :
665668 break
@@ -786,13 +789,24 @@ import CZitiPrivate
786789 }
787790
788791 case . LoginExternal:
789- onAuth ( authEvent. detail)
792+ // detail is just the hostname or signer name, not the full OIDC URL.
793+ // Kick off the OIDC flow to get the real auth URL via the launch callback.
794+ ziti. extAuthStatusCallback = { _, url, _ in
795+ log. info ( " \( modeLabel) extAuth URL: \( url) " , function: " runEnrollTo() " )
796+ onAuth ( url)
797+ }
798+ ziti. perform {
799+ ziti_ext_auth ( ziti. ztx, Ziti . onExtAuthStatus, ziti. toVoidPtr ( ) )
800+ }
790801
791802 case . CannotContinue:
792- let detail = authEvent. detail. isEmpty ? " authentication cannot continue " : authEvent. detail
793- log. error ( " \( modeLabel) : \( detail) " , function: " runEnrollTo() " )
803+ let msg = !authEvent. error. isEmpty ? authEvent. error
804+ : !authEvent. detail. isEmpty ? authEvent. detail
805+ : " authentication cannot continue "
806+ let code = !authEvent. errorCode. isEmpty ? authEvent. errorCode : nil
807+ log. error ( " \( modeLabel) : \( msg) (errorCode= \( code ?? " nil " ) ) " , function: " runEnrollTo() " )
794808 ziti. shutdown ( )
795- enrollCallback ( nil , ZitiError ( detail ) )
809+ enrollCallback ( nil , ZitiError ( msg , errorCodeString : code ) )
796810
797811 default :
798812 break
0 commit comments