I'm using this module to build an integration with Google Health and ran into a few problems. I've therefore created the attached patch file to correct these problems:
1. Google Health uses a non-standard URL to request the AuthSub token from. Therefore, I added support for passing a url variable to the module. If you don't pass a url variable, then it will use the default URL.
2. It seems that the drupal_urlencode() function called by the module does some strange things to secure URL's. For whatever reason, I found that it was dropping the "s" in https when passing the URL's to Google. Therefore, I replaced drupal_urlencode() with the standard PHP urlencode() function, which seems to work fine.
This patch file is designed to patch the 2010-Jul-11 dev version of this module. Hopefully, the developer will incorporate these changes into the next dev release.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | google_auth.patch | 1.67 KB | bkonia |
| google_auth.patch | 1.55 KB | bkonia |
Comments
Comment #1
bkonia commentedDid some more work on this and discovered that the developer had used an str_replace() function to replace AuthSubRequest with AuthSubSessionToken to build the URL needed to obtain the session token. Unfortunately, this doesn't work when using a non-standard AuthSub URL, such as what's needed for Google Health. After doing some research, I discovered that session tokens are obtained using the same URL, regardless of which Google service you're accessing. Also, the additional parameters the developer was passing in the URL are not necessary to obtain the session token. They are passed during the initial redirect to Google, so it's redundant to pass them a second time and Google ignores them anyway. Therefore, I got rid of the line containing str_replace() and simply hard coded the actual URL that you need to call in order to obtain a session token. That URL is:
https://www.google.com/accounts/AuthSubSessionToken
and as I mentioned, it never changes, regardless of which service you are accessing.
I've attached a new patch file that includes the original patches, plus this one. After making these changes, I was able to successfully authenticate to Google Health.
Comment #2
izmeez commentedsubscribing