I am trying to get Google OAuth working on iOS so I can make requests to the Google Calendar API. I am currently using this code to load a Google login sheet into a UIWebView and try to get an access token back..
[AISWebView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"https://accounts.google.com/o/oauth2/auth?scope=https://www.googleapis.com/auth/calendar&redirect_uri=%@&response_type=code&client_id=%@",kSharedURI,kClientId]]]];
I am managing to get what I think is the access token from a text field that appears here, by parsing the HTML again and again using NSString. But when I attempt to use what I think is the access token to make this calendar request using NSMutableURLRequest, I get a response from Google saying
error = {
code = 401;
errors = (
{
domain = global;
location = Authorization;
locationType = header;
message = "Login Required";
reason = required;
}
);
message = "Login Required";
};
If anyone has any ideas they would be absolutely appreciated. Thanks.