I've searched here a bit but could not find an answer to my issue.
I implement oAuth client with spring-sec-oAuth 2.0 (1.0.0.RC2a). After properly setting the beans.xml, I happily get a valid token and all looks good. Then, I want to use Calendar APIs - I'm not sure how do I make the call to get the Calendar object.
My (relevant) settings: (spring-servlet.xml)
<!--apply the oauth client context-->
<oauth:client id="oauth2ClientFilter" />
<oauth:resource id="google"
type="authorization_code"
client-id="<my client id>"
client-secret="<my client secret>"
access-token-uri="https://accounts.google.com/o/oauth2/token"
user-authorization-uri="https://accounts.google.com/o/oauth2/auth"
scope="https://www.googleapis.com/auth/calendar"
client-authentication-scheme="form"
pre-established-redirect-uri="https://ohad.sealdoc.com/oauth2-client/hello" />
<bean id="googleClientService" class="com...GoogleClientServiceImpl">
<property name="butkeDemoRestTemplate">
<oauth:rest-template resource="google" />
</property>
and the implementation class:
public class GoogleClientServiceImpl implements DemoService
{
private RestOperations butkeDemoRestTemplate;
@Override
public String getTrustedMessage()
{
String dataUri = "https://www.googleapis.com/calendar/v3/users/me/calendarList?minAccessRole=writer";
Calendar service = butkeDemoRestTemplate.getForObject(dataUri, Calendar.class);
return "demo";
}
}
Doing so ends up with:
Request processing failed; nested exception is error="invalid_request", error_description="{errors=[{domain=usageLimits, reason=accessNotConfigured, message=Access Not Configured}], code=403, message=Access Not Configured}"
Definitely, I'm doing something wrong in my "getTrustedMessage()", so I'm hear to consult the experts... I DO want to use OAuth2RestTemplate, but how do I know the URI I should use? After searching (Google), I found only examples of Google code, and they use Google oAuth (which I do not want to use - I'd rather use Spring implementation for my client)
any ideas?
GOT IT!
I've resolved this problem (getting the "403, message=Access Not Configured" thing) by simply enabling the specific service in Google APIs Console, under "Services"...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With