3

I im following the tutorial found here: https://developers.google.com/google-apps/calendar/quickstart/android

The project compiles and runs however gives the error 403: "access not configured. the api (calendar api) is not enabled for your project."

I have searched around and it seems like for most people it is because they did their package name wrong, however I copied and pasted it directly from the code. I was also wondering why we generate an api key but never copy it into the android project. I found somewhere that the API key can is added to the android manifest like this:

<meta-data
            android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version" />
<meta-data android:name="com.google.android.calendar.v2.API_KEY" android:value="MYAPIKEY" />

I have tried v2 as is above and v3 (which i believe is the current version). I have tried generating keys using my keystore and the android keystore, both specifying the app or not specifying any apps.

What is the correct way to add the api key to the project to get rid of this error? or is there something else im doing wrong?

EDIT: the post suggested by multiple people has not solved my problem as I have set it to allow connections from all android applications (same as "any referrer allowed") and it still gives me the error.

Erik Stagg
  • 88
  • 2
  • 10
  • possible duplicate of [Getting Error 403: Access Not Configured. Please use Google Developers Console to activate the API for your project](http://stackoverflow.com/questions/22870082/getting-error-403-access-not-configured-please-use-google-developers-console-t) – Ashesh May 09 '15 at 04:58
  • I saw that post and changed my key to allow any android application to access (equivalent to "any referrer allowed") and it still doesnt work – Erik Stagg May 09 '15 at 05:03
  • @ErikStagg did you solve this problem??? – Taranmeet Singh Dec 01 '15 at 14:56

3 Answers3

0

See the last line?

<meta-data android:name="com.google.android.calendar.v2.API_KEY" android:value="MYAPIKEY" />

replace MYAPIKEY with your key.

also your question is very similar to this one: Getting Error 403: Access Not Configured. Please use Google Developers Console to activate the API for your project.

Fortunately it has a working solution, try that.

Community
  • 1
  • 1
Ashesh
  • 3,499
  • 1
  • 27
  • 44
  • yea i put MYAPIKEY there (only in this post) as to not give away my own key, and I have looked at that post already and tried it as stated in the OP (referers = android apps that access) – Erik Stagg May 09 '15 at 05:02
0

I run into the exact problem and I finally figured it out. Unlike the Google Map API, an generated "API Key" won't work. You have to create an "OAuth 2.0 client ID" where the SHA1 and application ID matches your project. Because the SHA1 and application ID is used, you don't need to declare a API Key in the AndroidManifest.xml anymore.

enter image description here

Take my test project for example, the API Key works for Google Map on Android, but not for Google Calendar. I had to create the OAuth 2.0 client ID in order for it to work.

Xi Wei
  • 1,669
  • 1
  • 21
  • 33
0

The problem is only with generating the SHA-1 key. keytool -exportcert -alias advance -keystore /Users/EazyWorldPeace/Desktop/Advance/yourkey.jks -list -v

run this command on your mac/windows as per your path settings and keep the same package name as you have in your app and this will work.

Let me know if its not working with you -:)

Zia
  • 270
  • 2
  • 7