diff --git a/Classes/BITAuthenticator.h b/Classes/BITAuthenticator.h index f680d43ef3..8adb828fd0 100644 --- a/Classes/BITAuthenticator.h +++ b/Classes/BITAuthenticator.h @@ -220,6 +220,12 @@ typedef NS_ENUM(NSUInteger, BITAuthenticatorAppRestrictionEnforcementFrequency) */ @property (nonatomic, strong) NSURL *webpageURL; +/** + * URL to query the device's id via external webpage + * Built with the baseURL set in `webpageURL`. + */ +- (NSURL*) deviceAuthenticationURL; + /** * The url-scheme used to idenfify via `BITAuthenticatorIdentificationTypeDevice` * diff --git a/Classes/BITAuthenticator.m b/Classes/BITAuthenticator.m index 10c82407ac..263f2a1c72 100644 --- a/Classes/BITAuthenticator.m +++ b/Classes/BITAuthenticator.m @@ -479,9 +479,15 @@ static NSString* const kBITAuthenticatorAuthTokenTypeKey = @"BITAuthenticatorAut return authToken; } +- (NSURL *)deviceAuthenticationURL { + return [self.webpageURL URLByAppendingPathComponent:[NSString stringWithFormat:@"apps/%@/authorize", self.encodedAppIdentifier]]; +} + - (void)authenticationViewControllerDidTapWebButton:(UIViewController *)viewController { - NSURL *hockeyWebbasedLoginURL = [self.webpageURL URLByAppendingPathComponent:[NSString stringWithFormat:@"apps/%@/authorize", self.encodedAppIdentifier]]; - [[UIApplication sharedApplication] openURL:hockeyWebbasedLoginURL]; + NSURL *url = [self deviceAuthenticationURL]; + if(url) { + [[UIApplication sharedApplication] openURL:url]; + } } - (BOOL) handleOpenURL:(NSURL *) url