"You are not authorized to access this API" with GmailSettingsService

869 views
Skip to first unread message

nkm

unread,
Aug 15, 2012, 4:32:42 AM8/15/12
to google-app...@googlegroups.com

I'm using gdata 1.0 core libs and the class GmailSettingsService to retrieve an email signature. This works perfectly fine with my own credentials (I'm an admin on the domain). But with any other user I get the error message "You are not authorized to access this API" (complete error in the end of this email) . We have a google apps for business subscription. I thought the problem was to "Enable provsioning API" (under domain setttings->user setting). But it didn't make a difference. I've also created a new role with access to provisioning API and added the user there but it didn't make a difference. I've also waited now about 20 hours so I think it's no delay problem either. 

My code: 

GmailSettingsService service = new GmailSettingsService("emailsettings-or-any-name", domain, userName, login);
String sign = service.retrieveSignature(user.getEMailUser());

I hope someone can help me with this problem. 

Nils

The complete error message: 

Error message: com.google.gdata.util.ServiceForbiddenException: You are not authorized to access this API
<HTML>
<HEAD>
<TITLE>You are not authorized to access this API</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>You are not authorized to access this API</H1>
<H2>Error 403</H2>
</BODY>
</HTML>
 [13]
com.google.gdata.util.ServiceForbiddenException: You are not authorized to access this API
<HTML>
<HEAD>
<TITLE>You are not authorized to access this API</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>You are not authorized to access this API</H1>
<H2>Error 403</H2>
</BODY>
</HTML>

at com.google.gdata.client.http.HttpGDataRequest.handleErrorResponse(HttpGDataRequest.java:605)
at com.google.gdata.client.http.GoogleGDataRequest.handleErrorResponse(GoogleGDataRequest.java:564)
at com.google.gdata.client.http.HttpGDataRequest.checkResponse(HttpGDataRequest.java:560)
at com.google.gdata.client.http.HttpGDataRequest.execute(HttpGDataRequest.java:538)
at com.google.gdata.client.http.GoogleGDataRequest.execute(GoogleGDataRequest.java:536)
at com.google.gdata.client.Service.getEntry(Service.java:1352)
at com.google.gdata.client.GoogleService.getEntry(GoogleService.java:581)
at com.google.gdata.client.Service.getEntry(Service.java:1278)
at com.google.gdata.client.appsforyourdomain.AppsForYourDomainService.getEntry(AppsForYourDomainService.java:118)
at com.google.GmailSettingsService.retrieveSettingsEntry(GmailSettingsService.java:104)
at com.google.GmailSettingsService.retrieveSignature(GmailSettingsService.java:697)

nkm

unread,
Aug 15, 2012, 7:30:24 AM8/15/12
to google-app...@googlegroups.com
Partly I've answered this myself. If I use a super admins login instead of the actual user which I want to receive the signature for I can do it. So: 

GmailSettingsService service = new GmailSettingsService("emailsettings-or-any-name", domain, [superadminslogin], [password for super admin]);
String sign = service.retrieveSignature ( some other users complete email address );

So than I guess the question would be different. Do you need to be super admin to be able to login with this api or can I add some specific rights to make it work? 

Best regards

Nils

Mally Mclane

unread,
Aug 15, 2012, 7:33:52 AM8/15/12
to google-app...@googlegroups.com
Hi nkm


> So than I guess the question would be different. Do you need to be super
> admin to be able to login with this api or can I add some specific rights to
> make it work?

Google told us last year:

"Just to verify, it is only the super admin who has access to the
domain control panel and the API's within it. You cannot assign a user
specific privileges seperate to the other users on your domain. "

Even with the introduction of roles, it still needs to be a superuser:

http://support.google.com/a/bin/answer.py?hl=en&answer=1219251

It's not a good method, frankly.
> --
> You received this message because you are subscribed to the Google Groups
> "Google Apps Domain Information and Management APIs" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/google-apps-mgmt-apis/-/YPiaFsHBpWIJ.
>
> To post to this group, send email to google-app...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-apps-mgmt...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-apps-mgmt-apis?hl=en.

nkm

unread,
Aug 15, 2012, 8:27:12 AM8/15/12
to google-app...@googlegroups.com
Thank you so much for your answer! I've changed my code to use a specific super admin for login and it works fine... :-) 

> For more options, visit this group at
> http://groups.google.com/group/google-apps-mgmt-apis?hl=en.
> google-apps-mgmt-apis+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages