Skip to content

Commit

Permalink
Fix indentations in macOS example
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex-4-Git committed Feb 10, 2022
1 parent dd0681d commit 414f282
Showing 1 changed file with 44 additions and 43 deletions.
87 changes: 44 additions & 43 deletions Examples/Example-macOS/Source/AppAuthExampleViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -213,18 +213,18 @@ - (IBAction)authWithAutoCodeExchange:(nullable id)sender {
additionalParameters:nil];
// performs authentication request
self.appDelegate.currentAuthorizationFlow =
[OIDAuthState authStateByPresentingAuthorizationRequest:request
presentingWindow:self.view.window
callback:^(OIDAuthState *_Nullable authState,
NSError *_Nullable error) {
if (authState) {
[self setAuthState:authState];
[self logMessage:@"Got authorization tokens. Access token: %@",
authState.lastTokenResponse.accessToken];
} else {
[self logMessage:@"Authorization error: %@", [error localizedDescription]];
[self setAuthState:nil];
}
[OIDAuthState authStateByPresentingAuthorizationRequest:request
presentingWindow:self.view.window
callback:^(OIDAuthState *_Nullable authState,
NSError *_Nullable error) {
if (authState) {
[self setAuthState:authState];
[self logMessage:@"Got authorization tokens. Access token: %@",
authState.lastTokenResponse.accessToken];
} else {
[self logMessage:@"Authorization error: %@", [error localizedDescription]];
[self setAuthState:nil];
}
}];
}];
}
Expand Down Expand Up @@ -282,23 +282,23 @@ - (IBAction)authWithAutoCodeExchangeHTTP:(nullable id)sender {
// performs authentication request
__weak __typeof(self) weakSelf = self;
_redirectHTTPHandler.currentAuthorizationFlow =
[OIDAuthState authStateByPresentingAuthorizationRequest:request
presentingWindow:self.view.window
callback:^(OIDAuthState *_Nullable authState, NSError *_Nullable error) {
// Brings this app to the foreground.
[[NSRunningApplication currentApplication]
activateWithOptions:(NSApplicationActivateAllWindows |
NSApplicationActivateIgnoringOtherApps)];

// Processes the authorization response.
if (authState) {
[weakSelf logMessage:@"Got authorization tokens. Access token: %@",
authState.lastTokenResponse.accessToken];
} else {
[weakSelf logMessage:@"Authorization error: %@", error.localizedDescription];
}
[weakSelf setAuthState:authState];
}];
[OIDAuthState authStateByPresentingAuthorizationRequest:request
presentingWindow:self.view.window
callback:^(OIDAuthState *_Nullable authState, NSError *_Nullable error) {
// Brings this app to the foreground.
[[NSRunningApplication currentApplication]
activateWithOptions:(NSApplicationActivateAllWindows |
NSApplicationActivateIgnoringOtherApps)];

// Processes the authorization response.
if (authState) {
[weakSelf logMessage:@"Got authorization tokens. Access token: %@",
authState.lastTokenResponse.accessToken];
} else {
[weakSelf logMessage:@"Authorization error: %@", error.localizedDescription];
}
[weakSelf setAuthState:authState];
}];
}];
}

Expand Down Expand Up @@ -334,19 +334,20 @@ - (IBAction)authNoCodeExchange:(nullable id)sender {
self.appDelegate.currentAuthorizationFlow =
[OIDAuthorizationService presentAuthorizationRequest:request
presentingWindow:self.view.window
callback:^(OIDAuthorizationResponse *_Nullable authorizationResponse, NSError *_Nullable error) {
if (authorizationResponse) {
OIDAuthState *authState =
[[OIDAuthState alloc] initWithAuthorizationResponse:authorizationResponse];
[self setAuthState:authState];

[self logMessage:@"Authorization response with code: %@",
authorizationResponse.authorizationCode];
// could just call [self tokenExchange:nil] directly, but will let the user initiate it.
} else {
[self logMessage:@"Authorization error: %@", [error localizedDescription]];
}
}];
callback:^(OIDAuthorizationResponse *_Nullable authorizationResponse,
NSError *_Nullable error) {
if (authorizationResponse) {
OIDAuthState *authState =
[[OIDAuthState alloc] initWithAuthorizationResponse:authorizationResponse];
[self setAuthState:authState];

[self logMessage:@"Authorization response with code: %@",
authorizationResponse.authorizationCode];
// could just call [self tokenExchange:nil] directly, but will let the user initiate it.
} else {
[self logMessage:@"Authorization error: %@", [error localizedDescription]];
}
}];
}];
}

Expand Down Expand Up @@ -413,7 +414,7 @@ - (IBAction)userinfo:(nullable id)sender {
[request addValue:authorizationHeaderValue forHTTPHeaderField:@"Authorization"];

NSURLSessionConfiguration *configuration =
[NSURLSessionConfiguration defaultSessionConfiguration];
[NSURLSessionConfiguration defaultSessionConfiguration];
NSURLSession *session = [NSURLSession sessionWithConfiguration:configuration
delegate:nil
delegateQueue:nil];
Expand Down

0 comments on commit 414f282

Please sign in to comment.