agilebits / onepassword-app-extension

1Password Extension for iOS Apps
2.58k stars 313 forks source link

When using with a Google Oauth, cookies issue? #85

Closed akac closed 10 years ago

akac commented 10 years ago

Using the Google OAuth touch project and it works just fine in there…it fills in the credentials, but then I get a "Cookies must be allowed" error.

If I type in the info myself, it works fine.

screen shot 2014-08-28 at 1 12 16 pm

radazzouz commented 10 years ago

Hi @akac ,

Thank for reporting this issue :+1:

Are you trying to fill into the Google Oauth webView or into a regular webView? If your using the latter, is it a UIWebView or a WKWebview?

Also, are you getting any errors from the 1Password App Extension API or from the 1Password beta app?

I would be awesome if you could send us some sample code or a sample project so we can test it out too.

Thank you!

akac commented 10 years ago

We are using the Google OAuth web view. GTMOAuth2ViewControllerTouch

It is using a plain UIWebView at this time. I don’t believe they have moved yet to WKWebView and I doubt it will right away. So all I’ve done is taken Google’s GTMOAuth2ViewControllerTouch project (https://code.google.com/p/gtm-oauth2/)

and just added the button and then:

That’s it.

Here are the logs - no errors I can see.

2014-08-28 15:08:28.510 InformantPro[1814:659507] Discovered extensions: {( <NSExtension: 0x17012f1e0> {id = com.agilebits.beta.onepassword-ios.extension} )} for attributes: { NSExtensionActivationRule = { extensionItems = ( { attachments = ( { registeredTypeIdentifiers = ( "org.appextension.fill-webview-action" ); } ); } ); }; NSExtensionPointName = ( "com.apple.share-services", "com.apple.ui-services", "com.apple.services" ); } 2014-08-28 15:08:28.520 InformantPro[1814:659529] LaunchServices: invalidationHandler called Aug 28 15:08:30 AK-iPhone InformantPro[1814] : ImageIO: PNG Not enough image data Aug 28 15:08:30 AK-iPhone InformantPro[1814] : ImageIO: PNG No IDATs written into file 2014-08-28 15:08:55.148 InformantPro[1814:659448] completed request - items: ( "<NSExtensionItem: 0x170207c10> - userInfo: {\n NSExtensionItemAttachmentsKey = (\n \"<NSItemProvider: 0x17064c5d0> {types = (\n \"com.apple.property-list\"\n)}\"\n );\n}" )

As a side note, why won’t the extension use my TouchID?

On Aug 28, 2014, at 3:00 PM, Rad Azzouz notifications@github.com wrote:

Hi @akac https://github.com/akac ,

Thank for reporting this issue

Are you trying to fill into the Google Oauth webView or into a regular webView? If your using the latter, is it a UIWebView or a WKWebview?

Also, are you getting any errors from the 1Password App Extension API or from the 1Password beta app?

I would be awesome if you could send us some sample code or a sample project so we can test it out too.

Thank you!

— Reply to this email directly or view it on GitHub https://github.com/AgileBits/onepassword-app-extension/issues/85#issuecomment-53798316.

Alex Kac - President and Founder Web Information Solutions, Inc.

"Forgiveness is not an occasional act: it is a permanent attitude." -- Dr. Martin Luther King

akac commented 10 years ago

I just went and updated my Google libraries (we sync to Google Calendar/Tasks) and I noticed that the new libraries have different cookie handling.

Once I was done, retried it and it now worked! Here is the console info:

2014-08-28 15:36:06.530 InformantPro[1872:669525] LaunchServices: invalidationHandler called Aug 28 15:36:08 AK-iPhone InformantPro[1872] : ImageIO: PNG Not enough image data Aug 28 15:36:08 AK-iPhone InformantPro[1872] : ImageIO: PNG No IDATs written into file 2014-08-28 15:36:09.748 InformantPro[1872:669468] DiskCookieStorage changing policy from 2 to 0, cookie file: file:///private/var/mobile/Containers/Data/Application/4EE9AF88-19F1-407D-AD19-0DD3D54D3941/Library/Cookies/Cookies.binarycookies 2014-08-28 15:36:09.750 InformantPro[1872:669468] DiskCookieStorage changing policy from 0 to 2, cookie file: file:///private/var/mobile/Containers/Data/Application/4EE9AF88-19F1-407D-AD19-0DD3D54D3941/Library/Cookies/Cookies.binarycookies 2014-08-28 15:36:32.059 InformantPro[1872:669468] completed request - items: ( "<NSExtensionItem: 0x17820d8e0> - userInfo: {\n NSExtensionItemAttachmentsKey = (\n \"<NSItemProvider: 0x17805bd20> {types = (\n \"com.apple.property-list\"\n)}\"\n );\n}" ) 2014-08-28 15:36:32.072 InformantPro[1872:669468] DiskCookieStorage changing policy from 2 to 0, cookie file: file:///private/var/mobile/Containers/Data/Application/4EE9AF88-19F1-407D-AD19-0DD3D54D3941/Library/Cookies/Cookies.binarycookies 2014-08-28 15:36:32.073 InformantPro[1872:669468] DiskCookieStorage changing policy from 0 to 2, cookie file: file:///private/var/mobile/Containers/Data/Application/4EE9AF88-19F1-407D-AD19-0DD3D54D3941/Library/Cookies/Cookies.binarycookies 2014-08-28 15:36:39.816 InformantPro[1872:669468] DiskCookieStorage changing policy from 2 to 0, cookie file: file:///private/var/mobile/Containers/Data/Application/4EE9AF88-19F1-407D-AD19-0DD3D54D3941/Library/Cookies/Cookies.binarycookies 2014-08-28 15:36:39.818 InformantPro[1872:669468] DiskCookieStorage changing policy from 0 to 2, cookie file: file:///private/var/mobile/Containers/Data/Application/4EE9AF88-19F1-407D-AD19-0DD3D54D3941/Library/Cookies/Cookies.binarycookies

On Aug 28, 2014, at 3:09 PM, Alex Kac alex@webis.net wrote:

We are using the Google OAuth web view. GTMOAuth2ViewControllerTouch

It is using a plain UIWebView at this time. I don’t believe they have moved yet to WKWebView and I doubt it will right away. So all I’ve done is taken Google’s GTMOAuth2ViewControllerTouch project (https://code.google.com/p/gtm-oauth2/ https://code.google.com/p/gtm-oauth2/)

and just added the button and then:

  • (IBAction)fillUsing1Password:(id)sender { [[OnePasswordExtension sharedExtension] fillLoginIntoWebView:self.webView forViewController:self sender:sender completion:^(BOOL success, NSError *error) { if (!success) { NSLog(@"Failed to fill login in webview: <%@>", error); } }]; }

That’s it.

Here are the logs - no errors I can see.

2014-08-28 15:08:28.510 InformantPro[1814:659507] Discovered extensions: {( <NSExtension: 0x17012f1e0> {id = com.agilebits.beta.onepassword-ios.extension} )} for attributes: { NSExtensionActivationRule = { extensionItems = ( { attachments = ( { registeredTypeIdentifiers = ( "org.appextension.fill-webview-action" ); } ); } ); }; NSExtensionPointName = ( "com.apple.share-services", "com.apple.ui-services", "com.apple.services" ); } 2014-08-28 15:08:28.520 InformantPro[1814:659529] LaunchServices: invalidationHandler called Aug 28 15:08:30 AK-iPhone InformantPro[1814] : ImageIO: PNG Not enough image data Aug 28 15:08:30 AK-iPhone InformantPro[1814] : ImageIO: PNG No IDATs written into file 2014-08-28 15:08:55.148 InformantPro[1814:659448] completed request - items: ( "<NSExtensionItem: 0x170207c10> - userInfo: {\n NSExtensionItemAttachmentsKey = (\n \"<NSItemProvider: 0x17064c5d0> {types = (\n smb://n \"com.apple.property-list\"\n smb://n)}\"\n );\n}" )

As a side note, why won’t the extension use my TouchID?

On Aug 28, 2014, at 3:00 PM, Rad Azzouz <notifications@github.com mailto:notifications@github.com> wrote:

Hi @akac https://github.com/akac ,

Thank for reporting this issue

Are you trying to fill into the Google Oauth webView or into a regular webView? If your using the latter, is it a UIWebView or a WKWebview?

Also, are you getting any errors from the 1Password App Extension API or from the 1Password beta app?

I would be awesome if you could send us some sample code or a sample project so we can test it out too.

Thank you!

— Reply to this email directly or view it on GitHub https://github.com/AgileBits/onepassword-app-extension/issues/85#issuecomment-53798316.

Alex Kac - President and Founder Web Information Solutions, Inc.

"Forgiveness is not an occasional act: it is a permanent attitude." -- Dr. Martin Luther King

Alex Kac - President and Founder Web Information Solutions, Inc.

"You cannot build a reputation on what you intend to do." -- Liz Smith

akac commented 10 years ago

I'll mark this as closed now.

radazzouz commented 10 years ago

Hey @akac !

I'm really happy that you've sorted it all out. YAY!

I was just playing with Google Oauth API to try and test it :smile:

Please note that these following logs are expected when using the 1Password App Extension API.

2014-08-28 15:36:06.530 InformantPro[1872:669525] LaunchServices: invalidationHandler called

and

2014-08-28 15:36:32.059 InformantPro[1872:669468] completed request - items: (
    "<NSExtensionItem: 0x17820d8e0> - userInfo: {\n    NSExtensionItemAttachmentsKey =     (\n        \"<NSItemProvider: 0x17805bd20> {types = (\\n    \\\"com.apple.property-list\\\"\\n)}\"\n    );\n}"
)

If there's anything else that we can help you with, please let us know.

Cheers!

akac commented 10 years ago

Thanks. Now that part works, the actual authentication in the Google OAuth is broken :( So I need to figure that one out next. Sigh…the joys of using third party frameworks.

On Aug 28, 2014, at 3:42 PM, Rad Azzouz notifications@github.com wrote:

Hey @akac https://github.com/akac !

I'm really happy that you've sorted it all out. YAY!

I was just playing with Google Oauth API to try and test it

Please note that these following logs are expected when using the 1Password App Extension API.

2014-08-28 15:36:06.530 InformantPro[1872:669525] LaunchServices: invalidationHandler called and

2014-08-28 15:36:32.059 InformantPro[1872:669468] completed request - items: ( "<NSExtensionItem: 0x17820d8e0> - userInfo: {\n NSExtensionItemAttachmentsKey = (\n \"<NSItemProvider: 0x17805bd20> {types = (\n \"com.apple.property-list\"\n)}\"\n );\n}" ) If there's anything else that we can help you with, please let us know.

Cheers!

— Reply to this email directly or view it on GitHub https://github.com/AgileBits/onepassword-app-extension/issues/85#issuecomment-53805322.

Alex Kac - President and Founder Web Information Solutions, Inc.

“Don't forget until too late that the business of life is not business but living.” -- B.C. Forbes,

gabriel commented 9 years ago

Hi, @akac

Did you run into an issue with cookies after using the web fill in gtm-oauth2 (see #142). Did you have a workaround for that issue? (It's a little hard to tell in the comment thread above.)

akac commented 9 years ago

I did, but I updated to the - at the time - latest Google Auth framework and I believe that fixed it for me.

On Nov 24, 2014, at 1:31 PM, Gabriel Handford notifications@github.com wrote:

Hi, @akac https://github.com/akac Did you run into an issue with cookies after using the web fill in gtm-oauth2 (see #142 https://github.com/AgileBits/onepassword-app-extension/issues/142). Did you have a workaround for that issue? (It's a little hard to tell in the comment thread above.)

— Reply to this email directly or view it on GitHub https://github.com/AgileBits/onepassword-app-extension/issues/85#issuecomment-64259056.

Alex Kac - President and Founder Web Information Solutions, Inc.

"I am not young enough to know everything." --Oscar Wilde

gabriel commented 9 years ago

Oh gotcha...

I am using these podspecs:

GTMHTTPFetcher.podspec.json: https://gist.github.com/gabriel/ae31056545509bfbde5c gtm-oauth2.podspec.json: https://gist.github.com/gabriel/643ee838063f82ef1bb2

which point to recent trunk revisions. Then you can reference those locally:

pod "GTMHTTPFetcher", :podspec => "../GTMHTTPFetcher.podspec.json"
pod "gtm-oauth2", :podspec => "../gtm-oauth2.podspec.json"
radazzouz commented 9 years ago

Hi guys,

Thanks so much for helping out @akac :+1:

@gabriel, I am really glad that you've got it all sorted out now. This is awesome :smiley:

Can we assume that #142 is resolved?

Cheers guys!

gabriel commented 9 years ago

yeah... especially since its more a gtm-oauth bug than a 1password one

radazzouz commented 9 years ago

Thanks for replying so quickly @gabriel!

Best,