user2041230
user2041230

Reputation: 51

Need help creating Coldfusion App to Google Group API

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.

Upvotes: 4

Views: 402

Answers (1)

Matt Gifford
Matt Gifford

Reputation: 1268

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

Upvotes: 6

Related Questions