My code
$user = Socialize::with('facebook')->user();
then got
Client error response [url] https://graph.facebook.com/oauth/access_token?client_id=1562205014036534&client_secret=3b9807e0d826bfd66fb3fbdc627fd015&code&redirect_uri=http%3A%2F%2Ffacebooktest.dev [status code] 400 [reason phrase] Bad Request
and google
$user = Socialize::with('google')->user();
got look like same
Client error response [url] https://accounts.google.com/o/oauth2/token [status code] 400 [reason phrase] Bad Request
but twitter it's work
thank for clarify
I had the same problem and it was because of the version of socialite. I downgraded to 2.0.0 and the problem was gone.
The problem is your services(config/services.php). check your facebook client_id and client_secret if it correspond with the one from your facebook developers page.
If you are trying to loggin with another facebook account to test your application in development phase, it will throw same error.
Enjoy........
Related
I'm trying to use the oAuth functionality of adfs but are struggling to get an access token out of it.
The setup is a Windows Server 2012 R2 Preview Edition installed in a virtualbox vm.
I am able to get an access_code by issuing the following:
https://asdf.bla.dev/adfs/oauth2/authorize?response_type=code&client_id=abcd-abcd-abcd&redirect_uri=https://localhost/auth&resource=testservice.asdf.oauth
this redirects me to the following url
https://localhost/auth?code=U2dIhBsRt0eDnEhAEq2fcw.d3LeME__0QgBAC8zvLR6mTlRvC0.fLKd5eQRjXslTEeEck17m6Zo4fKKO9oGk2byUyr4CyLQHKSJs5wKzWZcusLXqXk22tdzvswxBjzaYcCqzkbeT5VxhMEdq97vbSnGAQ1tVD0vutVIfbx1Mb5A-QItgOx8a8LBapn7axCpGThoVH2jWCVM59X5eOt9ACuJTTK1UFbNaldaTkuGdqrtcGC8tFoSOP96G-4sHgIBpi2t8BSwCdf3asDd3AJAOYk6gnUkH5WJQRf2pg4S_AkgOxseeZW8Y5qbWAajyESkEmJ-UcWkV98uHlrmNsFwTSJ-ZoNk-aZI_U85ZlZrsdpKzocrWM5HmfcvXm5XdXz2QXIHngIBTA
but when I try to redeem the token with this request:
https://asdf.bla.dev/adfs/oauth2/token?grant_type=authorization_code&client_id=abcd-abcd-abcd&redirect_uri=https://localhost/auth&code=U2dIhBsRt0eDnEhAEq2fcw.d3LeME__0QgBAC8zvLR6mTlRvC0.fLKd5eQRjXslTEeEck17m6Zo4fKKO9oGk2byUyr4CyLQHKSJs5wKzWZcusLXqXk22tdzvswxBjzaYcCqzkbeT5VxhMEdq97vbSnGAQ1tVD0vutVIfbx1Mb5A-QItgOx8a8LBapn7axCpGThoVH2jWCVM59X5eOt9ACuJTTK1UFbNaldaTkuGdqrtcGC8tFoSOP96G-4sHgIBpi2t8BSwCdf3asDd3AJAOYk6gnUkH5WJQRf2pg4S_AkgOxseeZW8Y5qbWAajyESkEmJ-UcWkV98uHlrmNsFwTSJ-ZoNk-aZI_U85ZlZrsdpKzocrWM5HmfcvXm5XdXz2QXIHngIBTA
there is an error and I don't get an access-token.
The event viewer of the adfs service states the following error:
There are no registered protocol handlers on path /adfs/oauth2/token to process the incoming request....
I built the request following this information: https://github.com/nordvall/TokenClient/wiki/OAuth-2-Authorization-Code-grant-in-ADFS
I have no idea what's going wrong and would really appreciate your help!
I know that the thread is quite old but I was going through hell today when trying to resolve this error. I checked http.sys, reinstalled the server role,... nothing worked.
At the end, I had to find out that this crazy ADFS does (again) return garbage error messages. After 5 hours of debugging I didn't trust postman any longer (even if it worked without issues for months now) and used a short PowerShell script to invoke the POST with the access code:
$client = new-object net.webclient
$form = New-Object System.Collections.Specialized.NameValueCollection
$form.Add("client_id", "you client id")
$form.Add("grant_type", "authorization_code")
$form.Add("code", "authorization code")
$form.Add("redirect_uri", "your redirect uri")
$result = $client.UploadValues("https://sso.mydomain.com/adfs/oauth2/token", "POST", $form)
$decodedToken = $client.Encoding.GetString($result);
Et voila... all working. So I went back to the broken postman query, stripped all url parameters, removed all headers and added the parameters to the x-www-form-urlencoded tab. Then it worked there again.
Meaningful errors would definitely be helpful. Hope this saves someone many hours of frustrating try&error...
You are on the right track. You get code on redirect URI. Now we will have to make a POST request to the /token endpoint using the following parameters:
code - you will have to extract this value from the URL using some programming logic
client_id
redirect_uri
grant_type - use the value "authorization_code"
In response you should get a JWT access token.
It looks like you use HTTP GET to access the token endpoint, but it should be HTTP POST.
I am trying exchange authentication code to access token on OAuth2.
I sent a request to google using GET request, and I got a code. And now I'm trying to exchange the code to access token.
I sent request to https://accounts.google.com/o/oauth2/token with these arguments
using POST request
code=[Authentication code]
client_id=[Client ID]
client_secret=[Client Secret]
redirect_uri=urn:ietf:wg:oauth:2.0:oob
grant_type=authorization_code
But google responsed like this with 400 error
{
"error" : "redirect_uri_mismatch"
}
I created Client ID on google developers console. I used type 'Installed Application'.
I also tried:
request_uri=#://localhost:8081
request_uri=#://localhost:8081/
(# means http. I edited on my phone, so I couldn't insert code block for http)
But it didn't worked.
What's wrong with request?
Check these 2 steps below
The redirect uri to retrieve auth code and access token should be same
Use the same redirect uri that you configured while creating the application, screenshot below
Working on my Google Glassware and everything seemed to be going fine. I tried loading it up the other day after a while of not working on it and had an OAuth error. I tried refreshing the key and even starting a new project. The Error I got has atleast changed I am now getting -
An error occurred: Error refreshing the OAuth2 token, message: '{ "error" : "unauthorized_client" }'
The code is pretty much completely based off of the PHP Quick Start. This happens when I try and authorize the app with my account. I know my information is correct for the config.php file. Any suggestions?
I think in this case , it is possible that Authorization server has not allowed to access Authorization grant type
{error: 'unauthorized client'} may be related to Authorization server settings
Grant_types it has allowed.
Reference: http://tools.ietf.org/id/draft-ietf-oauth-v2-12.html#token-errors
I am using google OAuth2.0 for LinkedIn integration in IOS. But I got 404 error when app try to get the accesstoken. Can you have a look at it and give me some guidance? Thanks in advance
I have tracked the request and have them below:
Generate the authorization code, the http request like below:
https://www.linkedin.com/uas/oauth2/authorization?client_id=dqabmvt35aee&redirect_uri=http%3A%2F%2Fwww.google.com%2FOAuthCallback&response_type=code&scope=r_emailaddress&state=DCEEFWF45453sdffef424
Then get the redirect URI like:
http://www.google.com/OAuthCallback?code=AQRnqUBueoz5jZqolVl5suiUQFnLExkmRQSOdndgFK59t4cKC4EjUm38zTbXjDvLwWItUrYrXnOt6KRxTz_SZ5m0Qq3t9rZHG1q-aqltb79m7ZJ5K2Y&state=DCEEFWF45453sdffef424
Do the post request for getting accessToken
https://www.linkedin.com/uas/oauth2/accessToken/
Request body like:
client_id=dqabmvt35aee
&client_secret=tlsAaUCZ5XtrTfHz
&code=AQRnqUBueoz5jZqolVl5suiUQFnLExkmRQSOdndgFK59t4cKC4EjUm38zTbXjDvLwWItUrYrXnOt6KRxTz_SZ5m0Qq3t9rZHG1qaqltb79m7ZJ5K2Y
&grant_type=authorization_code
&redirect_uri=http%3A%2F%2Fwww.google.com%2FOAuthCallback
And the got 404 error here.
Finally I figured it out by myself. What caused this issue is about the access token URL. I have the SLASH end of this URL which caused this issue. In google oauth 2.0 library, we should set the accesstoken url like "https://www.linkedin.com/uas/oauth2/accessToken", not should be "https://www.linkedin.com/uas/oauth2/accessToken/"
I am integrating api in my application. when I am trying to tweet I am getting an error request 401, it seems to "Authentication credentials were missing or incorrect". How will I remove this error ?
Thanks