change clientid for google oauth, add compatible for google oauth for web
This commit is contained in:
parent
78afae4fb6
commit
c1236fa604
@ -26,7 +26,7 @@
|
||||
@import GoogleSignIn;
|
||||
|
||||
static NSString * const kClientID =
|
||||
@"53206975661-0d6q9pqljn84n9l63gm0to1ulap9cbk4.apps.googleusercontent.com";
|
||||
@"53206975661-qan0rnefniegjv53ohild375pv0p7ekd.apps.googleusercontent.com";
|
||||
|
||||
|
||||
static WebPageViewController *webpageVC = nil;
|
||||
@ -202,7 +202,7 @@ static WebPageViewController *webpageVC = nil;
|
||||
[self nativeCb:funid hasErr:YES dataStr: error.localizedDescription];
|
||||
return;
|
||||
}
|
||||
NSString *url = [NSString stringWithFormat:@"%@?client_id=%@&response_type=%@&redirect_uri=%@&scope=%@&state=%@", json[@"endpoint"], json[@"client_id"], json[@"response_type"], json[@"redirect_uri"], json[@"scopes"], funid];
|
||||
NSString *url = [NSString stringWithFormat:@"%@?client_id=%@&response_type=%@&redirect_uri=%@&scope=%@&state=%@&nonce=%@", json[@"endpoint"], json[@"client_id"], json[@"response_type"], json[@"redirect_uri"], json[@"scopes"], funid, funid];
|
||||
// check if json has "response_mode"
|
||||
if (json[@"response_mode"] != nil) {
|
||||
url = [NSString stringWithFormat:@"%@&response_mode=%@", url, json[@"response_mode"]];
|
||||
@ -251,8 +251,21 @@ static WebPageViewController *webpageVC = nil;
|
||||
state = item.value;
|
||||
}
|
||||
}
|
||||
if ([NSString isStringEmpty:token] || [NSString isStringEmpty:state]) {
|
||||
return;
|
||||
if ([NSString isStringEmpty:token] || [token isEqualToString: @"undefined"]) {
|
||||
if ([NSString isStringEmpty:[url fragment]]) {
|
||||
return;
|
||||
} else {
|
||||
components.query = [url fragment];
|
||||
for (NSURLQueryItem *item in components.queryItems) {
|
||||
if ([item.name isEqualToString:@"token"]) {
|
||||
token = item.value;
|
||||
} else if ([item.name isEqualToString:@"id_token"]) {
|
||||
token = item.value;
|
||||
} else if ([item.name isEqualToString:@"state"]) {
|
||||
state = item.value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// send token to server
|
||||
[self nativeCb:state hasErr:NO dataStr:token];
|
||||
@ -262,7 +275,7 @@ static WebPageViewController *webpageVC = nil;
|
||||
-(void)nativeCb:(NSString *)funid hasErr: (BOOL) hasErr dataStr:(NSString *) dataStr {
|
||||
// check if had presentViewController, if had, then dismiss it
|
||||
if (self.presentedViewController != nil) {
|
||||
[self dismissViewControllerAnimated:NO completion:nil];
|
||||
[self dismissViewControllerAnimated:YES completion:nil];
|
||||
}
|
||||
if ([NSString isStringEmpty:funid]) {
|
||||
NSLog(@"nativeCallBack with empty funid: %@", funid);
|
||||
|
Loading…
x
Reference in New Issue
Block a user