I'm using linkedin-oauth2 gem
to connect with LinkedIn Api. The following snippet gives me 403 error:
client = LinkedIn::API.new(user_access_token)
client.profile # works well
client.network_updates # gives 403 error
I gave all possible permissions to the app (including rw_nus). Any ideas?
You are getting probably this issue because you are not setting properly the scope for the omniauth gem to request this permissions on the client-side oauth2 besides how the app permissions are configured in the Linkedin developer network site.
Try addind something like
:scope => 'r_fullprofile r_contactinfo r_emailaddress r_network'
to the existing config line you might have in the Omniauth (or Devise) initializer file.
provider :linkedin, ENV['LINKEDIN_KEY'], ENV['LINKEDIN_SECRET']
Then you should get both Apps working good.
Check the permission because linkedin api is changed go through the url for more info http://www.oodlestechnologies.com/blogs/recent-changes-in-linkedin-api
I think it's a problem on LinkedIn side connected with cache. Adding permissions to the existing app doesn't work but creating app with needed permissions gives exactly what i want.
Related
I am developing a NextJS application using next-auth with Google Oauth 2 as its authentication provider. The production build is running on Heroku. When attempting to sign in on my production build, Google OAuth is giving me "Error 400: redirect_uri_mismatch". Normally this would be an easy fix, except the exact uri is already registered in Cloud Console.
.
I have also tried added many different permutations of my uri, but this did not help.
This issue not solved by 11485271 or 69151061.
Error in question:
Error 400: redirect_uri_mismatch
You can't sign in to this app because it doesn't comply with Google's OAuth 2.0 policy.
If you're the app developer, register the redirect URI in the Google Cloud Console.
Request Details
If you’re the app developer, make sure that these request details comply with Google policies.
redirect_uri: https://middcourses2.herokuapp.com/api/auth/callback/google
And here is a link to the list of authorized domains in GCP.
Solved! So for some reason, Google changed my Client ID and Client Secret after I already set up those env variables. Once I noticed the change and inputted the new values it worked fine.
For me, clientID was not the issue, but this was due to a trailing slash( / ).
redirect_uri must be an EXACT MATCH on the developers console.
In the Google Cloud console, I had http://localhost:8080 under the redirect URIs in the list while my code was sending http://localhost:8080/ while making the oAuth call.
I'm using Laravel Socialite in a project and added the Twitter Provider in order to be able to allow my users to integrate with their Twitter account. I followed the steps here https://socialiteproviders.com/Twitter/ and I'm getting the following error:
Received HTTP status code [401] with message "{"errors":[{"code":32,"message":"Could not authenticate you."}]}" when getting temporary credentials.
If I leave the TWITTER_REDIRECT_URI in my env file blank, the error goes away and the Oauth flow works exactly as it's supposed to. Is anyone else having this issue? If the TWITTER_REDIRECT_URI isn't needed why have it in the docs?
I have installed the Google Drive Realtime API sample files on my web server, following these instructions, including generating a client_id in the Cloud Console and inserting it into the index.html file.
When I visit that page and click the button to authorize the app, it pops up with a new window and shows:
Error: invalid_client
no registered origin
The Request Details are:
openid_connect_request=true
cookie_policy_enforce=false
scope=https://www.googleapis.com/auth/drive.install https://www.googleapis.com/auth/drive.file https://www.googleapis.com/auth/plus.me
response_type=token
access_type=online
redirect_uri=postmessage
proxy=oauth2relay865404532
origin=http://mywebsite.com
state=264939258|0.165356673
display=page
client_id=1077585001321.apps.googleusercontent.com
authuser=0
I can't see any other client_id that I should be using in the Cloud Console. Does anybody know how to overcome this error? Thanks for your help.
In the new Google API Console, configure your OAuth2.0 authorized origins from
Your Project > APIs & auth > Credentials
You might need to add a new Client ID specifically for a web application (I did because the default was for AppEngine)
Create Client ID > Web Application > Authorized Javascript origins
If you are running on a local dev server, just add the exact URL such as :
http://127.0.0.1:9000
UPDATE: I changed accepted answer to Johno Scott instead as he refers to the newer version of the console, whereas mine was only true for the older version.
I solved it. I needed to enter a WEB ORIGIN on the OAuth 2.0 Client ID screen. Specifically, it had to be the exact path/url of the index.html file, otherwise it defaults to the root domain which doesn't work.
This screenshot shows you exactly where it needs to be entered:
I have sucesfully installed securesocial in my play 2 app and I have it working for google and facebook. But i am having an issue with twitter
My conf file has the following
#
# Twitter
#
securesocial.twitter.requestTokenURL=https://twitter.com/oauth/request_token
securesocial.twitter.accessTokenURL=https://twitter.com/oauth/access_token
securesocial.twitter.authorizationURL=https://twitter.com/oauth/authenticate
securesocial.twitter.consumerKey=mykey
securesocial.twitter.consumerSecret=mysecret
but I am getting the following exception.
securesocial.provider.AuthenticationException: Authorization failed (server replied with a 401). This can happen if the consumer key was not correct or the signatures did not match.
My key and secret are the same as they are on my twitter API account app that I have created for this app. I have also included the website and the #anywhere domain from where this request is being called from.
Any ideas?
Make sure the time in your computer is properly set. Twitter will return that error if the local time in your computer is out of some offset compared to the time in their servers. Hope this helps.
I have an application on Heroku which uses omniauth and authenticates correctly when I visit myapplication.heroku.com/auth/open_id, input my google endpoint, and get redirected back.
However, when I visit myapplication.com, with heroku custom domains setup and working for every other url, I get Application Error from heroku after being redirected back from Google (I have not tried other openid providers).
I have hoptoad setup and it is not sending me any notifications about the specific error (probably because omniauth is middleware). Nothing shows up in heroku logs besides that there was a [nginx] GET request at the url which gave the error.
it probably doesn't matter, but this is a rails app.
localhost production testing works fine.
ideas?
I am not sure whether this fixes your problem, but I encountered a similar problem on my app (OAuth with Facebook, Rails, Heroku). It turned out the problem was caused by the following line:
session["devise.facebook_data"] = env["omniauth.auth"]
(which stores the OAuth data in the session in case the user does not have an account yet and has to complete a signup form before he can be persisted).
This caused a ActionDispatch::Cookies::CookieOverflow (which also was not reported by Hoptoad/Airbrake) for some users whose omniauth.auth hash was too large to be stored in the session cookie. Hence I fixed this issue by preprocessing the hash and throwing out everything that is not needed, before saving it to session. Maybe your bug is related to this?
I had the same problem.
myurl.com resulted in 502 bad gateway, while .herokuapp.com worked fine.
I had set
use Rack::Session::Cookie
To enable session cookies, but for some reason, the Ngnix proxy at Heroku didn't like this. When i changed it to:
use Rack::Session::Cookie, :key => 'rack.session',
:path => '/',
:expire_after => 14400,
:secret => 'change_me'
ie. made sure there was no domain key in the hash.