Facebook Device Flow Support - facebook

According to the Facebook docs, OAuth Device Flow is supported.
However, when I follow their directions on starting the Device Flow process, I receive a status code of 400 (Method not implemented).
Has anyone successfully able to get the Facebook Device Flow process functioning?
curl -X post https://graph.facebook.com/oauth/device?type=device_code&client_id={appId}
<HTML>
<HEAD>
<TITLE>400 Bad Request</TITLE>
</HEAD>
<BODY>
<H1>Method Not Implemented</H1>
Invalid method in request<P>
</BODY>
</HTML>

About your specific error, it seems facebook docs made you do it wrong: FAIL
You must send a POST request, which you're asking cURL to do, but request data must not be part of the URL. Instead, you should use the -d option to specify the sent data and use the URL up to the ? sign, like shown in this superuser question
But! Even if you used the right HTTP method, you'd get an error that reads:
Unsupported type: 'device_code'. Supported types: web_server, user_agent, client_cred, username
Now the best part: this happens unless you use the client_id facebook themselves used for their demo! In that case, you get a 200 (OK) response with the expected code, user_code and verification_uri. Apparently their application is somehow different from those we're trying with. No hint in the app configuration page about this.
By the way, I haven't found anyone claiming to have successfully used facebook's Device Flow, have you?

Here's an example implementation, but I haven't managed to get it working with my own project:
https://oauth-device-demo.appspot.com/

I also encountered the same error.
look this article
http://forum.developers.facebook.net/viewtopic.php?id=105132
it's teach your how set app, but after trying, nothing change~
you can try~

Related

Mailchimp No Host Exception when Subscribing Email to A List

I'm trying to send a subscription call, but got an error saying the the URL is invalid.
This is the URL I used:
https://us14.api.mailchimp.com/3.0/lists/<list-id>/members/
then I get this back in the response:
<HTML>
<HEAD>
<TITLE>Invalid URL</TITLE>
</HEAD>
<BODY>
<H1>Invalid URL</H1>
The requested URL "http://%5bNo%20Host%5d/3.0/lists/41e44e1bde/members/", is invalid.
<p>
Reference #9.cc6a1db8.1483891456.16189371
</BODY>
</HTML>
which translates to:
http://[No Host]/3.0/lists/<list-id>/members/
us14 is definitely the right data center according to the documentation so I'm not quite sure what's wrong.
It turned out that if you set HTTP header field "Host" in the request, it will always return this error. I tested this out by removing every fields one-by-one and this was the only one that caused an issue.
Many environments use the Host header for stuff like virtual sites where you are running more than one website behind the same IP Address (i.e. api.mailchimp.com and www.mailchimp.com could be on the same server) It is definitly possible for an error to be received if you set an invalid host since their proxies can't route it correctly. Normally, the host header is set automatically by the browser or HTTP client and usually not something you would override.
Are you still having trouble? If so, would be useful to see a screenshot of something like PostMan or https://ApiRequest.IO to see what your inputs are.

getting redirect uri mismatch error in google plus despite having no uri mismatch

Please consider the following two websites that I am pinging as shown in the image below:
I have a google plus login icon where a user can click on it and can sign in using his/her google account.
My website where all the login code is residing is say for example xyztesting.com as shown in the image. And all the code related to xyztesting.com resides on the box 10.11.10.12 which has a domain name abctesting.com.
So, when i ping abctesting.com, I get Packets Sent and Received = 4 as shown in the image.
However, when I ping xyztesting.com , I get Request timed out as shown in the image below.
Does anyone knows whether this could be the reason behind why I am getting Redirect URI Mismatch error 400 error whenever a user tries to log in using google plus ?
I have ensured that the REDIRECt URI in the request matches the Registered Redirect URIs which is the most common message displayed when some one encounters this error and this is the most common fix suggested online everywhere.
I have referred to lot of previous related posts, including this one where they talks about making sure that the request URI's should match the registered URI on google developer console.
I have got a feeling that since there is not a dedicated box/server for my website xyztesting.com, google is thowing such error. Please let me know if anyone has experienced such type of error with the situation I have described above?
Sometimes, the redirect uri should be set to "postmessage" not the actual uri.
The documentation is not so clear on that setting.
-Dragonfire

Facebook server-side OAuth 2.0 on localhost:8080 can't get access token missing redirect_uri

There are many other question related to this, but they didn't help me fix my problem.
I'm using the Facebook server-side login for a website, which I want to test locally. The path that initiates the login action is [http://localhost:8080/fblogin] (this redirects to the Facebook login dialogue, and goes from there).
I can successfully get the code, but when I try to exchange that for an access token, I get the following error:
{"error":{"message":"Missing redirect_uri parameter.","type":"OAuthException","code":191}}
I am providing the redirect_uri, url encoded and it is the same as the one I use to get the first code. Here is the url I'm using to request the access token (with the all-caps query string parameters replaced with their actual values, of course):
https://graph.facebook.com/oauth/access_token?client_id=CLIENT_ID&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2Ffblogin&client_secret=CLIENT_SECRET&code=CODE_FROM_FB
I suspect this might have to do with how my app is set up on Facebook. Here are the values I have set:
Display Name: (an actual display name here)
App Domains: localhost
Contact email: (an actual email here)
Site URL: [http://localhost:8080/fblogin]
What do I need to tweak in the settings to get this to work? Or does this look correct?
By the way, if it makes any difference, I am using the Play! framework, version 2.0.1
After digging around a little more, I found that it was necessary for me to use POST when sending the request from my server to get the access token.
Interesting that using POST worked for you as this didn't for me.
In any case, did you add the query parameters using setQueryParameter()? (see How to make multiple http requests in play 2?)

How To Register New User Using Dwolla API

This started as a question, but in the process of posting this question, I solved it. So now, this is an FYI post...
==========
At first, whenever I tried to post to this URL, I would get an error message:
https:// www.dwolla.com/oauth/rest/register --> Bad URL
There is no operation listening for
http:// phx-dwol-web1.cloudworks.com/oauth/rest/register, but there is
an operation listening for
http:// www.dwolla.com/oauth/rest/register/, so you are being
redirected there.
I fixed by appending the auth values to the post URL:
https://www.dwolla.com/oauth/rest/register/?client_id={id}&client_secret={secret}
--> Good URL
Then, I was having trouble with request formatting. To fix this, make sure that you post JSON in the BODY of the post. Do NOT append to the URL, or submit as form fields.
Lastly, when I finally got a proper response from the Dwolla API, I was getting this error:
"New user must accept terms of service."
This is because the Dwolla API is CASE SENSITIVE, so the "ACCEPTTERMS" parameter in the JSON body must be submitted as "acceptTerms" in order for it to work.
Here is the documentation I am referencing:
http://developers.dwolla.com/dev/docs/register
Happy coding!
Thanks for the answer...it ultimately led to me solving my problem as well.
For completeness, I encountered this error when sending a poorly formed request to the api, where I had left off the trailing / before the get parameter {oauth_token}.
INCORRECT:
http://www.dwolla.com/oauth/rest/users?oauth_token={oauth_token}
CORRECT:
http://www.dwolla.com/oauth/rest/users/?oauth_token={oauth_token}

A simple facebook app gets Method Post is not allowed error

I tried a very simple helloworld example facebook app. Basically I have a webpage, only contains one file index.php, which only contains one line: echo "helloworld". I have registered this app as an facebook app, configured the setting, canvas url to http://mydomain/..
I can load the page mydomain/index.php. However, when I load the page http://apps.facebook.com/appid, I got the following error:
The requested method POST is not allowed for the URL ...
I checked apache config, there is no or settings to prevent POST method.
Apache error log ad access log does not say anything.
Do you have any clue how to fix this?
Thanks for your kind help!
The first request a Facebook app makes is a POST request. It seems your server is not accepting them. A common problem is having something like:
http://mydomain.com/index.html
Instead of
http://mydomain.com/index.php
Either way check your HTTP logs you will probably see an error ( possibly 405 ) with more details.