GTMOAuth2ViewControllerTouch extra view : "Please copy this code, switch to your application and paste it there:"

3,084 views
Skip to first unread message

Lubo Astinov

unread,
May 13, 2012, 12:01:14 PM5/13/12
to Google Data APIs Objective-C Client Library Discussion
Hi all,

I was wondering how to get rid of the extra view that comes after the
user allows access via the GTMOAuth2ViewControllerTouch object.

I am dismissing the view controller in the finish callback, but the
view still shows up for a second or more before it goes away. It seems
like it is called before the finish callback.

Any clues?

Thx

P.S. My clientID was created for an installed application...

Greg Robbins

unread,
May 13, 2012, 5:57:19 PM5/13/12
to gdata-objec...@googlegroups.com
There is not enough information in your message to know what view is showing up.

It is common for app developers to push an extra view, prior to starting sign-in, that will be displayed between the dismissal of the sign-in webview and the invocation of the callback (during the period when the controller must do an additional fetch or two to exchange the OAuth 2 code and to obtain user information, after web sign-in completes.)

The controller also posts a kGTMOAuth2UserSignedIn notification for apps to use to display a brief interface during that interval.

The discussion group for the gtm-oauth2 sign-in controllers is at http://groups.google.com/group/gtm-oauth2

Lubo Astinov

unread,
May 13, 2012, 10:41:52 PM5/13/12
to Google Data APIs Objective-C Client Library Discussion
I'm sorry, I was indeed unclear...

Implementing the OAuth2 authorization via the
GTMOAuth2ViewControllerTouch object as provided in the YouTube sample
of the Objective-C examples, however on iOS, not OSX.

Everything works fine, except for right after the user approves or
denies the request. There is a "page" that is loaded right after that
which says "Please copy this code,switch to your application and copy
it there:"

I do not wish for the user to see it, because it is dismissed right
after the complete callback is called and is irrelevant for the user
(he/she do not actually need to do what the page is saying).

This view/page is displayed before the callback is called and thus I
was wondering how can I avoid it altogether, meaning, right after the
user taps accept or deny on the request confirmation page?

Thanks for the help!

Greg Robbins

unread,
May 14, 2012, 2:30:35 AM5/14/12
to gdata-objec...@googlegroups.com
The controller does try to dismiss the webview as soon as the confirmation page is loaded. Set a breakpoint in the GTMOAuth2SignIn class method handleCallbackReached to see just when the controller has detected the sign-in flow is complete. 

Lubo Astinov

unread,
May 14, 2012, 10:35:41 AM5/14/12
to gdata-objec...@googlegroups.com
Greg,
Thanks for reaching out, I appreciate it. I did follow it through, I actually set thosebreak points there. Unfortunately the callbacks arrive just too late. 

The fastest way to dismiss it I found so far is to listen for the notification. Even faster is to hack the titleChanged method and monitor for the title of the page, but that is so horribly hackish that I don't want to do it....

Can you think of any another way?

Thanks. 

Lubo Astinov

On May 13, 2012, at 11:30 PM, Greg Robbins <grob...@google.com> wrote:

The controller does try to dismiss the webview as soon as the confirmation page is loaded. Set a breakpoint in the GTMOAuth2SignIn class method handleCallbackReached to see just when the controller has detected the sign-in flow is complete. 

--
You received this message because you are subscribed to the Google Groups "Google Data APIs Objective-C Client Library Discussion" group.
To post to this group, send email to gdata-objec...@googlegroups.com.
To unsubscribe from this group, send email to gdata-objectivec-...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gdata-objectivec-client?hl=en.

Greg Robbins

unread,
May 14, 2012, 11:27:08 AM5/14/12
to gdata-objec...@googlegroups.com
Since servers may change the html they display, including adding pages for additional security steps, I don't know of any safe ways to more quickly intercept the end-of-flow detection and hide the webview.

Bryan Farris

unread,
Apr 1, 2013, 1:57:03 PM4/1/13
to gdata-objec...@googlegroups.com
Greg and Lubo...did you ever get closer to an answer on this question? I'm observing the exact same issue.  For now I'm just leaving it as is, but would like to make the experience a little cleaner.

Ash Furrow

unread,
Apr 9, 2013, 1:51:06 PM4/9/13
to gdata-objec...@googlegroups.com, luboa...@gmail.com
I managed to fix this by placing the view controller in a navigation controller, and then presenting the navigation controller modally. 
Reply all
Reply to author
Forward
0 new messages