Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8076789
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T15:20:16+00:00 2026-06-05T15:20:16+00:00

I am trying to access Google+ APIs with Oauth 2.0 in iPhone Application. For

  • 0

I am trying to access Google+ APIs with Oauth 2.0 in iPhone Application. For this purpose I am using OauthConsumer library. I got the unauthorized request_token and also authorization code but not able to exchange that request_token for access_token using authorization code. I am getting error as “invalid_request”. Below is the code snippet, am I doing anything wrong or missing any parameter?

Code:

-(void)getAccessTokenWithAuthorizationCode:(NSString *)code
{

    NSURL *accessTokenURL = [NSURL     URLWithString:@"https://accounts.google.com/o/oauth2/token"];

    OAMutableURLRequest *accessRequest = [[OAMutableURLRequest alloc] initWithURL:accessTokenURL
                                                                    consumer:consumer
                                                                       token:requestToken
                                                                       realm:nil   // our service provider doesn't specify a realm
                                                           signatureProvider:nil]; // use the default method, HMAC-SHA1
    [accessRequest setHTTPMethod:@"POST"];

    OARequestParameter *authCode = [[OARequestParameter alloc] initWithName:@"code" value:code];
    OARequestParameter *redirectURI = [[OARequestParameter alloc] initWithName:@"redirect_uri" value:kRedirectURI];
    OARequestParameter *granType = [[OARequestParameter alloc] initWithName:@"grant_type" value:@"authorization_code"];

    [accessRequest setParameters:[NSArray arrayWithObjects:authCode, redirectURI, granType, nil]];

    OADataFetcher *fetcher = [[OADataFetcher alloc] init];

    [fetcher fetchDataWithRequest:accessRequest 
                     delegate:self 
            didFinishSelector:@selector(accessTokenTicket:didFinishWithData:) 
              didFailSelector:@selector(accessTokenTicket:didFailWithError:)];
} 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T15:20:17+00:00Added an answer on June 5, 2026 at 3:20 pm

    FYI – I’m not familiar with Objective-C, but hopefully some knowledge of OAuth will help you figure this out.

    “authorized request tokens” are used in OAuth 1.0
    “authorization codes” are used in OAuth 2.0

    I’m not seeing anything saying that OauthConsumer supports OAuth 2.0

    You asked:
    “am I doing anything wrong or missing any parameter?”

    I think you are missing the client secret, which is necessary to exchange an authorization code for an access token in OAuth 2.0. See the Google OAuth 2.0 documentation for more information on what you need to provide to exchange an authorization code for an access token.

    You might want to check out the Google Toolbox for Mac – OAuth 2 Controllers:

    http://code.google.com/p/gtm-oauth2/wiki/Introduction

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to access Gmail by using three-legged Oauth PHP code provided by Google
I am trying to access the google calendar using gdata. but the application closes
I'm trying to get access to the Google Drive API using RestKit on iOS
I'm trying to get offline access token (refresh_token) with omniauth google-oauth2 strategy. This is
I am trying to access google calendar from php program. I am using a
I m trying to access a rdf file from the google nexus.....(now this code
I'm trying to write application for Android to access Google Tasks. I decided to
I'm trying to migrate an Android application using OAuth 1.0a to OAuth 2.0. (using
I am trying to get OAuth working with the .NET library for Google Data
I'm trying to implement sign in with Google using Oauth (using DotNetOpenAuth). I need

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.