Twitter followers list not getting - android

I know twitter api update to 1.1 and i have get successfully token & tokenSecret
I have checked both api
https://api.twitter.com/1/friends/ids.json?cursor=-1&screen_name=myscreenname
response getting
{"errors": [{"message": "The Twitter REST API v1 is no longer active. Please migrate to API v1.1. https://dev.twitter.com/docs/api/1.1/overview.", "code": 68}]}
https://api.twitter.com/1.1/friends/ids.json?cursor=-1&screen_name=myscreenname
response getting
{"errors":[{"message":"Bad Authentication data","code":215}]}
Please help me to get Response of Followers ids list.

Just tried to execute your request (https://api.twitter.com/1.1/friends/ids.json?cursor=-1&screen_name=myscreenname) in dev console and it works like a charm.
Seems like you've missed the authorization step (autorization with OAuth is required for api v1.1), so verify that you authorized with valid credentials.
You can read more about auth on twitter here or check out documentation for library that you are using to make api requests.

Related

Failed to Test Access to Google Photo

After trying to read ALL the documentation about Google Photo API access ... I've failed.
Just testing web access with:
https://photoslibrary.googleapis.com/v1/mediaItems:search
It gave: error code: 401
"message": "API keys are not supported by this API. Expected OAuth2 access token or other authentication credentials that assert a principal. See https://cloud.google.com/docs/authentication"
I tried using the client ID (xxxxxxx) generated with this request:
https://photoslibrary.googleapis.com/v1/mediaItems:search?client_id=xxxxxxx
Besides "client_id" I tried "key" with no luck.
What is the API REST format for "Expected OAuth2 access token"
Thanks!!

Alexa app to app account linking in android app , Skill Activation Api gives error

here is the link
https://developer.amazon.com/en-US/docs/alexa/account-linking/app-to-app-account-linking-starting-from-your-app.html
Steps that I followed in my Android App.
I completed the LWA fallback url setup , in fallback URL I have used client ID that is received from Account linking page of Alexa custom skill.
After open the LWA url in browser , page asked to Login in Amazon after that I can see the page where my skill asked to access the lwa details with an Allow and Cancel button
After Allow My Application is getting Auth-Token , From that Auth-Token I am calling token API and getting Access Token.
after that I am calling below activation skill api
POST /v1/users/~current/skills/{skillId}/enablement HTTP/1.1
Host: api.amazonalexa.com, api.eu.amazonalexa.com,
api.fe.amazonalexa.com
Content-Type: application/json
Authorization: "Bearer {Amazon Access Token}"
{
"stage": "skill stage",
"accountLinkRequest": {
"redirectUri": "https://yourRedirectURI",
"authCode": "Your user's authorization code from your authorization
server",
"type": "AUTH_CODE"
}
}
I have used parameters values like below
Amazon access token - Got that from Amazon token API.
redirectUri = https://pitangui.amazon.com/api/skill/link/XXXXXXXXXXX
authCode = got after perform successful login with amazon.
But I got 400 bad request error with Message
{"message":"Invalid account linking credentials"}
I am not able to get what I am doing wrong . Help me out if anyone have some suggestions.
The 400 bad request "Invalid account linking credentials" it's because you are receiving wrong credentials, so make sure that you are using correct client ID and secret to use skill Activation API.
I would recommend following this article.
https://amazon.developer.forums.answerhub.com/articles/240817/app-to-app-account-linking-debugging-tips.html

How do I authenticate with Google's REST services using a GoogleSignInAccount?

I'm writing an Android application that needs access to Google's Calendar API. I'd like to avoid using the Google API Client Library in favor of a simple Retrofit REST implementation. However, I can't seem to get the right authorization credentials in order to complete Calendar API REST calls. In my app, I sign in successfully with the following options:
GoogleSignInOptions
.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestScopes(Scope("https://www.googleapis.com/auth/calendar"))
.requestEmail()
.requestIdToken("WEB CLIENT ID HERE")
.build()
And I end up with a GoogleSignInAccount that gives me access to an idToken property. I've tried using this idToken as an OAuth 2.0 Bearer token in the authorization header of my request to the Calendar API, but I get rejected with a 401 every time. There's a lot of documentation around Google's OAuth process that seems to contradict itself or has escaped being updated, but it makes things very confusing. Any ideas about what I need to do in order to be able to use the REST APIs from my Android application?
Thanks, for the answer, I in-between managed to find out how to use the GoogleSignInAccount to authenticate the API-requests.
After you successfully signed in to your account using the google_sign_in plugin
(see the example for help) you can get the authentication headers that are required for the authentication of your api-request directly from the GoogleSignInAccount.
See:
GoogleSignInAccount _currentUser;
Future<Map<String, dynamic>> _getLabels() await {
http.Response _response = await http.get(
'https://www.googleapis.com/gmail/v1/users/'+_currentUser.id+'/labels',
headers: await currentUser.authHeaders,
);
return jsonDecode(_response);
}
authHeaders is implemented in Dart only, the source can be checked at https://pub.dev/documentation/google_sign_in/latest/google_sign_in/GoogleSignInAccount-class.html .
So the authHeaders are as follows:
"Authorization": "Bearer $accessToken",
"X-Goog-AuthUser": "0",
Now how can I obtain accessToken? Dart is calling GoogleSignInPlatform.instance.getTokens(email, shouldRecoverAuth: true); the impl of that method can be found here: https://github.com/flutter/plugins/blob/master/packages/google_sign_in/google_sign_in_platform_interface/lib/src/method_channel_google_sign_in.dart#L50
Aaaaand I'm giving up on this Google crap:
There is this magical chapter Obtain an access token from the Google Authorization Server. which says absolutely nothing on how to obtain access token. A prime example of shitty chatty useless doc that Google produces en masse.
The docu further sends me to https://developers.google.com/identity/sign-in/android/ which still doesn't explain how to get the accessToken.
That doc portal sends me to https://developers.google.com/identity/sign-in/android/start?authuser=2 which again talks web client instead of Android client, and I'm powerless. My limbs stop to move, my brain melts, my mouth opened in an endless silent scream of horror. This is how hell must look like. Reading Google docs is how hell must look like.

Unexpected response code 403 for https://api.linkedin.com/v1/people/~/mailbox

I'm using LinkedIn Android SDK to send invitations. I've configured the SDK to my android project(as a module) by following their documentations. While I'm trying to executing a REST API like
https://api.linkedin.com/v1/people/~/shares
with some valid JSON request it works fine, but when i try to call
https://api.linkedin.com/v1/people/~/mailbox
they return Access to sending invitation denied errorCode 0. Now I'm trying to look for valid linkedin invitation api.
Can any one please tell me, is my trying api correct to send invitation or not? If not please advise me the correct one and the procedure to implement.

Book a Taxi using OLA API

I want to use following OLA APis,
Products: Checks availability of taxis from pick up address
Products: Checks ride estimate from pick up address to drop off address
bookings/create: To book a Taxi
First two of them requires X-App Token, which I implemented successfully, but Booking a taxi requires X-App Token and authorization both. I got X-App Token while registering app. but unable to get authorization.
I suppose we can get authorization token after login. But no API available for login. So could anyone please tell, where we can get authorization token.
It may be possible we can get authorization token from "http://api.ola.gemius.com/auth/login", but it says "Wrong email or password", while I am already registered on OLA.
After registration of your APP, you will get below details
X-APP-TOKEN
OAuth URL
Redirect URI
If you run above OAuth URL, it will ask to login/register. After successful login, it will ask to accept/deny, click on accept then it will redirect to "Redirect URI" with the access_token value. check the below sample code.
localhost/ola/getdetails.php#access_token=1b0f48c26ee149cda389319106b17078&state=state123&scope=profile%20booking&token_type=bearer&expires_in=15551999
Note: access_token is the one which you want substitute against authorization
There are login apis-
Check the below link-
http://api.ola.gemius.com/doc/#authorization-login
http://developers.olacabs.com/api/3
You can also have a look at the following resources-
http://blog.attify.com/2015/02/01/ola-cabs-privacy-security-issue-discovered-appwatch/
https://medium.com/#CodeTheDevil/busting-ola-wallet-1ceea6174b1f

Categories

Resources