From e714d22e36a7ad6645859821378aa03356be7bf8 Mon Sep 17 00:00:00 2001 From: Niall Kennedy Date: Mon, 24 May 2021 19:28:31 -0700 Subject: [PATCH] Update revocation, token, userinfo endpoints Update revocation, token, userinfo endpoint URIs based on the latest published OIDC Discovery document https://accounts.google.com/.well-known/openid-configuration --- .../Example-iOS/Source/GTMAppAuthExampleViewController.m | 2 +- .../Example-macOS/Source/GTMAppAuthExampleViewController.m | 2 +- GTMAppAuth/Sources/GTMAppAuthFetcherAuthorization.m | 2 +- GTMAppAuth/Sources/GTMOAuth2KeychainCompatibility.m | 6 +++--- README.md | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Examples/Example-iOS/Source/GTMAppAuthExampleViewController.m b/Examples/Example-iOS/Source/GTMAppAuthExampleViewController.m index 118cf89a..b3d2d180 100644 --- a/Examples/Example-iOS/Source/GTMAppAuthExampleViewController.m +++ b/Examples/Example-iOS/Source/GTMAppAuthExampleViewController.m @@ -222,7 +222,7 @@ - (IBAction)userinfo:(nullable id)sender { fetcherService.authorizer = self.authorization; // Creates a fetcher for the API call. - NSURL *userinfoEndpoint = [NSURL URLWithString:@"https://www.googleapis.com/oauth2/v3/userinfo"]; + NSURL *userinfoEndpoint = [NSURL URLWithString:@"https://openidconnect.googleapis.com/v1/userinfo"]; GTMSessionFetcher *fetcher = [fetcherService fetcherWithURL:userinfoEndpoint]; [fetcher beginFetchWithCompletionHandler:^(NSData *data, NSError *error) { // Checks for an error. diff --git a/Examples/Example-macOS/Source/GTMAppAuthExampleViewController.m b/Examples/Example-macOS/Source/GTMAppAuthExampleViewController.m index f8e3c4b9..bba8e9c2 100644 --- a/Examples/Example-macOS/Source/GTMAppAuthExampleViewController.m +++ b/Examples/Example-macOS/Source/GTMAppAuthExampleViewController.m @@ -228,7 +228,7 @@ - (IBAction)userinfo:(nullable id)sender { fetcherService.authorizer = self.authorization; // Creates a fetcher for the API call. - NSURL *userinfoEndpoint = [NSURL URLWithString:@"https://www.googleapis.com/oauth2/v3/userinfo"]; + NSURL *userinfoEndpoint = [NSURL URLWithString:@"https://openidconnect.googleapis.com/v1/userinfo"]; GTMSessionFetcher *fetcher = [fetcherService fetcherWithURL:userinfoEndpoint]; [fetcher beginFetchWithCompletionHandler:^(NSData *data, NSError *error) { diff --git a/GTMAppAuth/Sources/GTMAppAuthFetcherAuthorization.m b/GTMAppAuth/Sources/GTMAppAuthFetcherAuthorization.m index a96de8e9..2211f20d 100644 --- a/GTMAppAuth/Sources/GTMAppAuthFetcherAuthorization.m +++ b/GTMAppAuth/Sources/GTMAppAuthFetcherAuthorization.m @@ -198,7 +198,7 @@ + (OIDServiceConfiguration *)configurationForGoogle { NSURL *authorizationEndpoint = [NSURL URLWithString:@"https://accounts.google.com/o/oauth2/v2/auth"]; NSURL *tokenEndpoint = - [NSURL URLWithString:@"https://www.googleapis.com/oauth2/v4/token"]; + [NSURL URLWithString:@"https://oauth2.googleapis.com/token"]; OIDServiceConfiguration *configuration = [[OIDServiceConfiguration alloc] initWithAuthorizationEndpoint:authorizationEndpoint diff --git a/GTMAppAuth/Sources/GTMOAuth2KeychainCompatibility.m b/GTMAppAuth/Sources/GTMOAuth2KeychainCompatibility.m index c98d07f9..b39e742f 100644 --- a/GTMAppAuth/Sources/GTMOAuth2KeychainCompatibility.m +++ b/GTMAppAuth/Sources/GTMOAuth2KeychainCompatibility.m @@ -308,17 +308,17 @@ + (NSURL *)googleAuthorizationURL { } + (NSURL *)googleTokenURL { - NSString *str = @"https://www.googleapis.com/oauth2/v4/token"; + NSString *str = @"https://oauth2.googleapis.com/token"; return (NSURL *)[NSURL URLWithString:str]; } + (NSURL *)googleRevocationURL { - NSString *urlStr = @"https://accounts.google.com/o/oauth2/revoke"; + NSString *urlStr = @"https://oauth2.googleapis.com/revoke"; return (NSURL *)[NSURL URLWithString:urlStr]; } + (NSURL *)googleUserInfoURL { - NSString *urlStr = @"https://www.googleapis.com/oauth2/v3/userinfo"; + NSString *urlStr = @"https://openidconnect.googleapis.com/v1/userinfo"; return (NSURL *)[NSURL URLWithString:urlStr]; } diff --git a/README.md b/README.md index a6d332de..17bccf2c 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ directly: NSURL *authorizationEndpoint = [NSURL URLWithString:@"https://accounts.google.com/o/oauth2/v2/auth"]; NSURL *tokenEndpoint = - [NSURL URLWithString:@"https://www.googleapis.com/oauth2/v4/token"]; + [NSURL URLWithString:@"https://oauth2.googleapis.com/token"]; OIDServiceConfiguration *configuration = [[OIDServiceConfiguration alloc] @@ -193,7 +193,7 @@ GTMSessionFetcherService *fetcherService = [[GTMSessionFetcherService alloc] ini fetcherService.authorizer = self.authorization; // Creates a fetcher for the API call. -NSURL *userinfoEndpoint = [NSURL URLWithString:@"https://www.googleapis.com/oauth2/v3/userinfo"]; +NSURL *userinfoEndpoint = [NSURL URLWithString:@"https://openidconnect.googleapis.com/v1/userinfo"]; GTMSessionFetcher *fetcher = [fetcherService fetcherWithURL:userinfoEndpoint]; [fetcher beginFetchWithCompletionHandler:^(NSData *data, NSError *error) { // Checks for an error.