Access denied - Search API from AngelList - api

When I'm calling the "search API" from AngelList (https://angel.co/api/spec/search) with the following URL:
https://api.angel.co/1/search?query=barack&type=Locations&callback=?access_token=707cfhgbdae43060876388ac584bf4cf4fdb
The result gives me an error: {"error":"access_denied","error_description":"You must pass in an access token when making this request."}
I'm not sure why this is happening because when I'm calling other APIs with the same access_token, these run successfully.
How I can solve this situation?

I think you have a typo in your URL. You need an extra & character for the access_token parameter. And probably you can remove your callback parameter as at this point you can retrieve the data from the response message.
Your URL should be like this:
https://api.angel.co/1/search?query=barack&type=LocationTag&access_token=707cfhgbdae43060876388ac584bf4cf4fdb.
It solved my problem at least :).

Related

Invidious API create token

I try to use Invidious API with authenticated route. For this, i've generated new token with this URL : https://invidio.us/authorize_token?scopes=GET:preferences.
The response is like this : {"session":"v1:XXXXX","scopes":["GET:preferences"],"signature":"XXXX"}
But, the token generated (session) don't work. I try with simple GET on preferences route, and i've an error Request must be authenticated :(
Anyone have already use their API and work with auth route ?
Thank you !
I've actually been struggling with this the past week, and I even deployed a self hosted instance because I thought that would fix it... I was wrong of course.
Here's how the Authentication header should look like:
Authentication: {"session":"v1:XXXXX","scopes":["GET:preferences/*"],"signature":"XXXX"}
The full token is the json that is provided.
The scope needs to include a * or a specific identifier for example in the case of playlists as mentioned in the examples here . So your authorize_token request should look like:
https://invidio.us/authorize_token?scopes=GET:preferences*
or
https://invidio.us/authorize_token?scopes=GET:preferences/*.
If you want all scopes that would be :*. Make sure not to forget the colon.

Trello API: Getting invalid token on all calls

I have a weird situation, which I hope you can help with.
I am trying to setup a simple Trello application. What I do are the following:
I go to https://trello.com/app-key and get my KEY
I go to https://trello.com/1/authorize?expiration=never&name=SinglePurposeToken&key=MYKEY for a permanent server to server key
I authorize
I get a token
Now I'm ready, but then when I want to make a call such as:
https://api.trello.com/1/boards/BOARDID/actions/?limit=2&key=MYKEY&token=MYTOKEN
I get "invalid token".
Reason I post here on StackOverflow, and not Trello support, is because I assume there is something basic I am doing wrong!
I was wrong about step 2).
I should use this link instead:
https://trello.com/1/authorize?expiration=never&scope=read,write&response_type=token&name=APPNAME&key=KEY
This gave the working token. All is well!

Instagram oAuthException missing url

I am unable to make any /media/search calls to the Instagram api without getting errors.
In firefox, the endpoint
https://api.instagram.com/v1/media/search?lat=48.858844&lng=2.294351&?access_token=VALID_ACCESS_TOKEN
(Where VALID_ACCESS_TOKEN, is a valid access token that works successfully with other api calls.)
I get the following output
{"meta":{"error_type":"OAuthParameterException","code":400,"error_message":"\"client_id\" or \"access_token\" URL parameter missing. This OAuth request requires either a \"client_id\" or \"access_token\" URL parameter."}}
I can't make sense of this error, since clearly, the access token is present in the url.
Could it be some weird character encoding issue?
Just a quick look at your URL and it looks like you have an extra ? in there before the access_token parameter.
https://api.instagram.com/v1/media/search?lat=48.858844&lng=2.294351&access_token=VALID_ACCESS_TOKEN
The first ? tells it to accept parameters, and then each param is separated by &. You shouldn't need any more ?'s and they may actually cause it to parse incorrectly.

Invalid Credential with XOAuth2 for Gmail

Recently, I am trying to get e-mails from Gmail, using XOAuth2 protocol.
Especially, I am using "OAuth2Authenticator.java" from https://code.google.com/p/google-mail-oauth2-tools/downloads/list.
But, I always get an invalid credential error like the follwoing:
A1 NO [ALERT] Invalid credentials (Failure)
Exception in thread "main" javax.mail.AuthenticationFailedException: [ALERT] Invalid credentials (Failure)
at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:566)
at javax.mail.Service.connect(Service.java:265)
Before reading, due to the limitation of putting a link, I cannot write "httoo://" so that please think of that this http header is front of some url information.
Before posting this question, I think I looked most of the articles about this one. Many articles are about using OAuth1.0 (deprecated) But, I still cannot figure out how I can make it work with OAuth2 & XOAuth2. I appreciate any suggestion/helps.
The following is the steps I am taking:
get an access token through OAuth2 with the scope of mail.google.com/
just put this access token & gmail account (e.g. test#gmail.com) into "OAuth2Authenticator.java".
After this procedure, I always get invalid credential.
The interesting stuff is that I can get unread mails through Feed URL (i.e. https://mail.google.com/mail/feed/atom) which is specified in Google OAuth2.0 Playground.
This indicates that I am sure that I get the correct access token. But, does not work at all for IMAP with this sample code.
Actually, the scope "mail.google.com/" is not included in the list of Google OAuth2.0 Playground.
For getting access token for XOAuth2, is there any other special way to get access token?
For the official page about XOAuth2, we need to use base64 to encode the access token.
But, I think the sample code is doing this procedure.
Also, SMTP of this sample did not work at all. But, after changing the properties, I could make it work. Is this code old?
But, unfortunately, what I need is IMAP. But, after trying setting some different/new properties, IMAP does not work at all....
I am stuck on this problem for a long time. So, I posted this question.
I really appreciate any suggestion/helps.
Regards
I figured out your problem regarding invalid credentials
A1 NO [ALERT] Invalid credentials (Failure) Exception in thread "main"
javax.mail.AuthenticationFailedException: [ALERT] Invalid credentials (Failure) at
com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:566) at
javax.mail.Service.connect(Service.java:265)
To remove above error you have to invalidate your Token and get a new token using below code
1- accountManager.invalidateAuthToken("com.google", token);
after invalidate token you have to get Refresh token using below code
String newToken = AccountManager.get(this).getAuthToken(new Account(account,"com.google"),
AUTH_TOKEN_TYPE, true, null, null).getResult().getString(AccountManager.KEY_AUTHTOKEN);
using new token now you are able to login.

Notification via open graph

I have a problem with adding notifications on Facebook.
According to:
https://developers.facebook.com/docs/reference/api/user/#notifications
I prepare request:
https://graph.facebook.com/FACEBOOK_USER_ID/notifications?template=hello&href=track_123&access_token=USER_ACCESS_TOKEN
but I get the response:
Sorry, something went wrong.
We're working on getting this fixed as soon as we can.
Is this request correct?
There is a slight problem in the above url , access token to be used is not of the user but of your app. First you need to get your app access_token by the use of the following get call.
GET https://graph.facebook.com/oauth/access_token?client_id=YOUR_APP_ID
&client_secret=YOUR_APP_SECRET
&&grant_type=client_credentials
This will return you app access token which you need to use in the above url.
Hopefully this will solve your problem.