I have generated the Client ID, Client Secret, redirect-url and code by the help of this API Documentation.
https://developers.google.com/youtube/2.0/developers_guide_protocol_oauth2#OAuth2_Installed_Applications_Flow
I am doing same as above Document, but gives the following error.
Error: invalid_request
Required parameter is missing: response_type
Currently for the version 3, the implementation is quite easy. Have a look at the Google Task sample.
Related
I want to implement UBER API into my android application.
I am using this link for the API and this link for the sandbox
In the header Authorization:
Bearer <token>
In the parameter:
start_latitude,start_longitude
I am following the tutorial, but I am getting an error message:
{"message":"Requires at least one scope. Available scopes: ","code":"unauthorized"}
Why is that?
How do you authorize your users? I'd recommend to check out this tutorial: https://developer.uber.com/docs/ride-requests/guides/authentication/introduction#oauth-20
Your URL should include the scope=requestparameter since you want to access the /v1/requests endpoint. Also keep in mind that you can use the request scope without having privileged access for up to 5 developers. You can maintain these in your developer dashboard.
I'm trying to implement the sample Twitter Digit app available on Github.
https://github.com/twitter/digits-android
But after following all the steps and populating every known place with API key and API secret.
My code is same I've just populated the properties file.
I'm getting: Digits﹕ HTTP Error: 403 Forbidden, API Error: 239, User Message: Try Again
Can anyone tell where the mistake is ?
The project will not work when copied as-is. You need to replace the consumer key and secret provided in the example project with your own. You can generate your own consumer key and secret via Fabric web portal.
#stack5: I have written this answer after reading the comments. I found that you've already received your answer. I'm writing this here so that anybody else facing similar issue would get benefited. Please accept this answer for the community.
I am using the GoogleAuthUtil and PlusClient.
When I specify my client id as:
NNNNNNNNNNN-HHHHHHHHHHHHHHHHHH.apps.googleusercontent.com
it gives me GoogleAuthException: Unknown as the error.
This is the clientId specified in the Google API Console.
When I specify my client id as:
NNNNNNNNNNN.apps.googleusercontent.com
it works? But this is not the clientId specified for my Android app?
When I try use this for OAuth the server fails to log in using this clientId.... So actually.. How do I resolve such a dilemma?
Solved it by just using the web id instead of android id which always gave me Auth Exceptions. hope this helps someone else solve this weird problem.
I try to use Google oauth to authenticate users on my android app.
Then I would like to send it to my app server so it can connect at any time with Google calendar.
I tried to use
GoogleAuthUtil.getToken(getApplicationContext(), mAccountName, mScope);
Following this article:
https://developers.google.com/accounts/docs/CrossClientAuth
When I use it with scope
mScope = "oauth2:https://www.googleapis.com/auth/calendar https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile";
I get a token, which is valid for an hour
But when I try to get an authorization code (so I can get a refresh token that is valid for longer time, using
mScope2 ="oauth2:server:client_id:{CLIENT_ID}.apps.googleusercontent.com"+ ":api_scope:https://www.googleapis.com/auth/calendar https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile";
I receive either "invalid_scope" or "Unknown" exceptions.
What am I doing wrong?
EDIT:
OK, After creating a new app on google API console and adding plus.login to the scope I get a code, but for some reason my server can't resolve this token. When tying to resolve server gets an error about the redirection URL.
BTW, When I do the web flow with same parameters it works.
OK, found the solution, I expected Google to have a lot better documentation about working with Google Oauth and Android. A few things you have to know to work with Android and offline token
When you create google Client ID Don't create a service application before you create a web application
Must include https://www.googleapis.com/auth/plus.login in your scope
The weirdest, to resolve the one time authorization code on my server, I had to use the redirection URL from the Android client ID details (which doesn't even look like a url) and not from the Web client details on Google API console.
That scope string is only documented to work when passed to GoogleAuthUtil(), see http://developer.android.com/reference/com/google/android/gms/auth/GoogleAuthUtil.html, on Android. But it would be cool if it worked on iOS too; our infrastructure there is a little behind where we’re at on Android.
I have had the same issue then i realised that my app is not published and is in debug mode, so i had to add test users to the Google project -> Consent Screen, then i was able to fetch the token for the added test user.
You just need to follow the correct steps/format for specifying the scopes. Find them here https://developers.google.com/android/guides/http-auth#SpecifyingScopes
So I am trying to sync to google docs, without having to ask the user for his credentials. I use this code to get an auth-token:
AccountManager mgr = AccountManager.get(activity);
authToken = mgr.blockingGetAuthToken(account, DocsService.DOCS_SERVICE, true);
This returns a auth-token that looks well-formated. So on my DocsService I run:
service.setAuthSubToken(authToken);
However, when I try to use the API I just get a AuthenticationException. Any ideas on how to approach this error?
edit: I do have the USE_CREDENTIALS permission.
The problem is that the returned token is a ClientLogin token, not an AuthSub token. An even bigger problem is that the GData Java Client library does not officially support Android. We recently added a note on the home page of the GData Java Client library that for Android we recommend Google API Client Library for Java instead.
Two samples come up mind that would be helpful for you for getting started with Google API Client Library for Java: calendar-v2-atom-android-sample and docs-v3-atom-oauth-sample
Disclosure: I am an owner of both the GData Java Client library and Google API Client Library for Java projects.
You might also want to take a look at Yaniv's Google I/O 2011 Session slides/video for reference on how to access the GData APIs on Android.
http://www.google.com/events/io/2011/sessions/best-practices-for-accessing-google-apis-on-android.html
As Yaniv explained, Gdata Lib doesn't work in Android. I wasted several hour with no result. It looks pretty weird, its Google's product and still not supported in their own platform (Android).
Anyway I have developed a Client Library which works on Android. I am managing the project on Google Code-
http://code.google.com/p/google-spreadsheet-lib-android/
You can give a try.