function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sforce2009sforce2009 

Could not connect to google apps account for creatin calendar events

Hi

     I am using google api toolkit to connect to the google calendar and create events there according to the events created in my salesforce account.

     But now, i need to connect to google apps calendar instead of normal gmail which i am doing with this function AuthSubUtil.getRequestPageReference().

     How do i do that. please help....

Ron HessRon Hess

not sure i understand, the calendar stuff is in the class CalendarService.cls

 

authsub is only for login portion.

 

can you post some code so show how you login?

 

did you read the docs for setting up a calendar connection ? 

 

here http://wiki.developerforce.com/index.php/Google_Calendar_API 

sforce2009sforce2009

Hi ron,

           thank you for the reply. here are the details

 

I have done my calendar integration through the below link only (http://wiki.developerforce.com/index.php/Google_Calendar_API )

  

PLEASE HELP

Message Edited by sforce2009 on 06-17-2009 10:48 PM
Message Edited by sforce2009 on 06-17-2009 10:53 PM
Message Edited by sforce2009 on 06-22-2009 04:53 AM
Ron HessRon Hess

   6. Here our client is having google apps login instead of gmail login.
    7. I am struck here how to show this google apps login instead of gmail login.

 

 

 

 

I don't understand, there is no gdata api for gmail, so when you call the auth url how can you arrive at a gmail login?

 

are you using google apps or google apps for your domain ?

 

did you try to construct the auth url and call it directly from a browser ( outside visualforce) , that is how i normally debug this process, paste the url into a browser, capture the response using firebug, then construct the next url, and so on.

 

 

what does the login screen from Google look like?

 

 

 

sforce2009sforce2009

The screen will look like, It will ask for google login on the right side. then it will give the grant access and deny access screen.

This is where we strucked, it accepts the gmail credentials but not the hosted domain's credentials like xxxx@xxxx.org

it will accept my gmail srinivas.d2s@gmail.com. but not like xxx@xxx.com which is a hosted domain.

 

and one more problem is , i am forwarding emails that are arrived to my gmail account to salesforce emailservice. There i have associated the service to an apex class which will then parse the email subject and updates it to on custom object.

 

The email arrives to my gmail account and it will forward to any other account except salesforce email service. what would be the issue here.

 

If you could give your skype Id or any messenger Id It would be of great help to me.

Message Edited by sforce2009 on 06-18-2009 08:16 AM
Ron HessRon Hess

sorry, no idea on that email question

 

 

for auth sub for your domain, you will have to modify the library, not sure what this will require as i did not build that out.

 

here is the article you will need to read.

http://googledataapis.blogspot.com/2008/04/announcing-authentication-proxy-service.html

 

it should be passing another param to the auth sub URL, which will require modifying AuthSubUtil.

 

from this page

http://code.google.com/apis/gdata/authsub.html

 

you can see two different methods of invoking (note this is the Java client lib version)

 

 

String authSubUrl = AuthSubUtil.getRequestUrl(nextUrl, scope, secure, session);  
String authSubUrl = AuthSubUtil.getRequestUrl(hostedDomain, nextUrl, scope, secure, session); 

 

 Since i did not build the second method, you will have to.

 

in fact you are in luck, this page

http://code.google.com/apis/accounts/docs/AuthSub.html

 

says that you need to add "hd=yourdomain.com" 

 

see this table

 

ParameterDescription
next(required) URL the user should be redirected to after a successful login. This value should be a page on the web application site, and can include query parameters.
scope(required) URL identifying the service(s) to be accessed; see documentation for the service for the correct value(s). The resulting token enables access to the specified service(s) only. To specify more than one scope, list each one separated with a space (encodes as "%20").
secure(optional) Boolean flag indicating whether the authentication transaction should issue a secure token (1) or a non-secure token (0). Secure tokens are available to registered applications only.
session(optional) Boolean flag indicating whether the one-time-use token may be exchanged for a session token (1) or not (0).
hd(optional) String value identifying a particular hosted domain account to be accessed (for example, 'mycollege.edu'). Use "default" to specify a regular Google account ('username@gmail.com').
btmpl(optional) Forces a mobile version of the approval page. The only accepted value is "mobile".


Good luck!

 

please post back the method if you build it and get it working.

 

Ron HessRon Hess

here is what i would try

 

 

 

public static pagereference getRequestPageReference(string hosted_domain, string proto, string host, String nextUrl, String scope) { // first we need to go thru the Salesforce GoogleAuthSub callback servlet // and that (next destination) needs to be encoded string encodedNext = proto + '://' + host + '/_ui/core/google/GoogleAuthSubCallback?url=' + EncodingUtil.urlEncode( nextUrl, 'UTF-8' ); // finaly construct the first step in the redirect process, send your users to this url // must be done by the end user, in a browser... return new PageReference( authRequest + '?next='+ encodedNext + '&hd=' + hosted_domain + '&scope='+ scope + '&session=1&secure=0'); }

 

 

 

sforce2009sforce2009

Thanks a lot for the help. It worked..... Just a small change i have done...

Instead of

 public static pagereference    getRequestPageReference(string hosted_domain, 
string proto, string host,
String nextUrl, String scope) {

 

 

I have taken as because there is no overload for getRequestPageReference with 5 params.

 

 public static pagereference    getRequestPageUrl(string hosted_domain, 
string proto, string host,
String nextUrl, String scope) {

 

 

 

 

sforce2009sforce2009

HI Ron, this is not working on Production account. It is simply saying attempt to de reference null object. I just get the

Grant Access page of google when it it returning it is sending 2 tokens in the url and says the above error. any help?