Im working on Contact's API with oAuth 2.0.. I want to fetch only a few fields and not the whole dataset. It works fine on the OAuth playground https://developers.google.com/oauthplayground
However, when using Jquery ajax to request it (after getting the token), it gives me the error Fields query parameter is not supported. Without the &fields= param, it works fine..
Here are the details about the fields param:
https://developers.google.com/gdata/docs/2.0/reference#PartialResponse
Btw, the reason for ajax request is well listed here:
Getting google contacts with javascript
The OAuth2 playground works with Google Contacts API V3, and the fields param is supposed to work with deprecated API v2 (you can even see a warning in the link you pointed for the fields params).
For V3, you cannot specify few fields than allowed. But you can select between a short answer, full answer with default fields, and full answer with extra fields not returned by default.
See Projection Values.
So, probably you want to request the thin Projection Value.
You can see it in action in the Playground using this URL on step 3:
https://www.google.com/m8/feeds/contacts/default/thin?alt=json
Pay attention to the thin, when most people and tutorials use full.
Related
I am using 2 Oauth services in my website. They both send back a query parameter called code. And I use a custom function to grab that code field when my page loads. Do OAuth services have a way you can change that code field to be custom? I am using Google OAuth for one and I am unable to locate this.
No, the standard specifies that the query parameter is named code, so there's no way to name them differently.
But the client can add a state parameter to the authorization request, which the authorization server has to return with the code. You can use that parameter to distinguish between the two authorization requests.
LinkedIn api provides access token to use it in url to post a message which uses oauth2 in Rest client. So by using the url in my application, i can post the message.
Twitter api uses oauth1 to tweet by accepting parameter.But the problem is timestamp,nounce,oauth_signature parameters gets auto generated and keep on changing for every request in Rest client.Here url is not sufficient to tweet, it need parameters but 3 parameters keep on changing on Rest client.
I tried to pass every parameter in url, it throws
error: code 32, could not authenticate you
i am dependent only on url to send a tweet.My application supports parameters too but three parameters are auto generating.I cant auto generate bcz i am hardcoding it in my application.
Is there any solution to tweet by using url?
Is there any way to make those 3 parameters fixed?
It's hard to tell what's going on here. Perhaps you could post more of the code and what you expected to happen?
By definition the nonce is a number only used once, and shouldn't be hardcoded. The timestamp also should reflect the current time on each request.
https://en.wikipedia.org/wiki/Cryptographic_nonce
I'm trying to authorize my standalone application. But after I click "Allow" it always redirects to http://oauth.vk.com/error?err=2 and gives this as response body:
{"error":"invalid_request", "error_description":"Security Error"}
Here's the request URL (I do have correct client_id):
https://oauth.vk.com/authorize?client_id=...&scope=messages,offline&redirect_uri=https://oauth.vk.com/blank.html&display=page&v=5.37&response_type=token
It seems that I've tried everything:
Turning application on and off
Passing scope as bit mask
URI encoding some parameters to have correct URL
and so on
After hour of searches I've found this.
So, it means that user has an old session and must re-login in browser.
Space in state parameter causes this.
OAuth 2 RFC, sections 4.1.1 on authorization request and 4.1.2 on authorization response, recommends using state parameter to maintain state in authorization code flow, particularly to prevent CSRF.
When I set this field to CSRFTOKEN123 http://my.site/next/url, I got this error. Replacing (space) with : to get CSRFTOKEN123:http://my.site/next/url helps.
By the way, I couldn't find any mention of state parameter on VK documentation website but VK OAuth 2 authorization system actually supports it. It couldn't be called OAuth 2 otherwise. So I find it legit to use state parameter.
The topic https://vk.com/topic-17680044_30635058 mentioned by author is closed now, current discussion is https://vk.com/topic-1_24428376. There are number of questions on this. All in Russian.
Twitter no longer allows default search widgets which use search.twitter.com/search.json
(It returns empty results for everything
Since 1.1 requires Auth, how can we put customized json queries on our sites just using javascript?
Twitter's new widgets return the result in html formatted form, so we can't use that either..
What should we do know? How do you do it now without auth?
I'm trying to UrlFetch the RSS/Atom feed from my site's news page "posts" URL https://sites.google.com/a/mydomain/my-site/my-announcements-page/posts.xml. It works in the browser for me as a logged user.
I am wanting to to do a Urlfetch because it seems to be a super fast way to get a count of pages and dates (<2 seconds). Doing it via the SitesApp Pages iteration or search takes 5 to 25 seconds). The site is a tiny one with lightweight content and < 50 pages.
Anyway, so I want to UrlFetch my site's posts URL and I guess I need an OAuth scope and get a token.
I have tried the scope "https://sites.google.com/feeds/" from the gdata Sites API https://developers.google.com/google-apps/sites/docs/1.0/developers_guide_protocol#Auth and using it on the Oauth Playground 2.0 and it works for documented API feed urls but not for my site's posts.xml URL. I get a 401 "Token invalid - AuthSub token has wrong scope" when I try to access that in the playground.
So my question is: Is it possible to use Urlfetch with an oauth token to access the pages's posts.xml? What OAuth scope do I use to get the token?
UrlFetchApp currently supports only OAuth 1.0. Try using that instead.
Just to close off this question. I didn't find a way to access the pages's posts.xml via a urlfetch. Instead, I created my own ContentService function to return as text the number of the page's children published since a particular time via myAnnouncementsPage.getChildren().