4

First, thanks in advance for anyone reading this post.

My school (I am a teacher/ technology coordinator) is using Google Apps for Education. I have used the Provisioning API to talk with our Microsoft Active Directory Server to synchronize users and groups with Google. I have a web-server that runs ColdFusion 9 and PHP. I am a basic to fair ColdFusion programmer and my PHP skills are neophyte level.

I have a minimum of 3028 groups I would like to update the replyTo field to say REPLY_TO_LIST (by default when group is created, users have a choice)

Ideally, what I would love to have happen is for the ColdFusion server to automatically (nightly) contact Google, get a list of all groups in the domain (users have rights to create groups so this list might change daily) and ensure the reply to field is set properly.

Currently, I am having problem with the OAuth 2.0 piece. I have read the documentation and am confused as to what I need to do. I have been looking all over the internet and have found a lot of material that is over my head. The closest I have gotten is a great post by Ray Camden. However, when I modify it for Google Groups, I get:

Error: invalid_request Required parameter is missing: response_type

However, the response_type is definitely present.

I am pretty sure it is my scope that is the beginnings of my problem and I have found multiple different references, such as:

Here is what I have so far in GoogleGroupModifier.cfm:

<cfset authurl = "https://accounts.google.com/o/oauth2/auth?" 
               & "client_id=#urlEncodedFormat(application.clientid)#" 
               & "&redirect_uri=#urlEncodedFormat(application.callback)#" 
               & "&scope=https://www.googleapis.com/auth/apps.groups.settings?response_type=code">

<cfoutput>
    /groups/v1/groups/
    authurl=#authurl#
    <p><a href="#authurl#">Login</a></p>
</cfoutput>

And the Application.cfc:

<cfcomponent>
    <cfset This.name = "googlegroups">
    <cfset This.Sessionmanagement="True">

    <cffunction name="onApplicationStart" returntype="boolean" access="public">
        <cfset application.clientid = "88888.apps.googleusercontent.com">
        <cfset application.clientsecret="zzzzzz_">
        <cfset application.callback="http://mydomain.org/wwp/google/GoogleGroupModifier.cfm">
        <cfreturn true>
    </cffunction>
</cfcomponent>

Can anyone offer any suggestions? I know there is information on GITHUB, but what I have tried there I cannot seem to get to work either.

Chris Morgan
  • 86,207
  • 24
  • 208
  • 215
  • 1
    Should the `?` before the response_type be an `&` ? – Peter Boughton Feb 04 '13 at 23:01
  • @PeterBoughton, you may as well write that up as the answer. https://developers.google.com/accounts/docs/OAuth2Login It looks like he typed a `?` out of habit when following the url. – genericHCU Feb 04 '13 at 23:48
  • That was just a guess. In this case I think Matt's "use a tested library" option is a better solution. – Peter Boughton Feb 05 '13 at 10:53
  • Yeah, I posted that then a few seconds later Matt added his answer. – genericHCU Feb 05 '13 at 13:37
  • Hi Peter and Travis, thanks so much for your help. That was indeed the main part of the problem! Like you said, force of habit from working with URL variables. "&scope=googleapis.com/auth/…; is what I have now for the scope. Additionally, after changing that setting, My return URI started giving me problems. What I had with Google was correct to the eye but must have had some white space in it. OAUTH 2 is working well. I am new to StackOverflow and am not sure about how to proceed with the other items in this post. Do I start a new thread? – user2041230 Feb 05 '13 at 20:36

1 Answers1

6

I have an OAuth2 cfc available on Github that will build the required auth and endpoint URLs for you: https://github.com/coldfumonkeh/oauth2

Matt Gifford
  • 1,268
  • 9
  • 13