How to solve this LinkedIn API error "Not enough permissions to access: GET /me", - reactjs

I am using this url "https://api.linkedin.com/v2/me?projection=(id,firstName,lastName,profilePicture(displayImage~:playableStreams))" for getting the user name and user image, but I am getting an error response.
This is the response I'm getting:
I am using React Linked In Login Using OAuth 2.0 package.

Related

Connect react native with my dialogflow account

I am creating this application currently following this tutorial
When I send a message in the chatbot, the onSend function works, however, I get an error with my chatbot's response and I am given this error in the console.
Received response:
{
"error":{
"code":401,
"message":"Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie, or another valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.",
"status":"UNAUTHENTICATED"
}
}
Can anyone help?
I have tried to see if my Google cloud APIs and services status is active and checked if my credentials have been revoked in IAM & Admin, still, the same error is returned in my console

Sign in with Linkedin not working (giving issue's of invalid access token and blocked by CORS Origin)

As I'm trying to integrate Linkedin API to get user's email to make a social sign in functionality in my project. Currently my project is working in react.js as frontend and node.js as backend.
I'm working in 'localhost:3000'.
For that I have created a App in Linked Developers section. From that I got my 'Client id' and 'Client Secret' key. And I also selected sign in with linkedin in products. Then I have integrated one package for react which helps me to sign with linkedin process. On clicking of that button it opens a popup which asks for linkedin signin. After that successfull sign in I get a code and state in response. When I enter that code for authorization it shows invalid access token. I tried to hit the API for authorization - "https://www.linkedin.com/oauth/v2/authorization. Then I hit the API - "https://api.linkedin.com/v2/me to get user profile but still getting the issue of "invalid access token".
I have read multiple documents and tried to integrate linkedin API in frontend as well as in backend too. But both side I'm getting error of CORS issue (Cross origin has blocked). or redirect_uri is not as per registered value. (I have entered multiple redirect_uri's in my linkedin app but none of them are working). or access token is not proper.
Please help me in this issue. I'm not getting why I'm having this error. What steps I have to follow Please guide me breifly.
I have tried to hit the API in multiple ways: postman, sample html file through AJAX, in react using its one of package, in php file using AJAX. But same issue in all.

Cognito Access Token + API Gateway Authentication - (Hosted UI vs Auth method on React js) returning different values from the same session

I am trying to implement API Gateway authentication using Cognito Access Token from an authenticated user, as shown in the video -> https://www.youtube.com/watch?v=bj3yVT6j3XU
To get the access token I am performing 2 methods:
1) Getting “Access Token” with Hosted UI + Code + Postman:
In the cognito user pool, I access the Hosted UI in the “App Client Configurations”:
After clicking the button above, and signing up with an existing user, I get the code in the url, as shown below:
With this code, I go to postman and can have access to the access token, as shown below:
Still using Postman, I call the API url with the header containing the “Authorization”, and I successfully get the response:
2) Getting “Access Token” with Auth method in React js:
I already tried to get the access token using the Auth.currentAuthenticatedUser() and Auth.currentSession(), and I realized they are the same. So here I am going to show the access token from the Auth.curentAuthenticatedUser().
When I try to use this access token in the react js code it doesn’t work, and I get the following error:
When I try to use this access token in the Postman, it also doesn’t work:
When I use the access token from the Hosted UI in the React js code, it works perfectly:
My questions are:
• Why I am getting different “Access Token”?
• How can I get the right access token in the React Js?
I found the solution - credits to Chirag from SrceCde.
The API call was "unauthorized" when I was using the AccessToken from the Amplify on React JS, due to scope.
The accessToken is generated with aws.cognito.signin.user.admin scope, as show the image below:
For that reason, it is necessary to enable the "aws.cognito.signin.admin" OAuth scope in the Cognito User Pool, and also consider the "aws.cognito.signin.admin" OAuth scope in the API Gateway for the API you want to call.
After doing that, you can get the accessToken with the Auth.currentAuthenticatedUser() method, as I was already doing.

Getting http 403 error while accessing photoURL of a firebase User

I am successfully authenticating an user with firebase authentication from an angular project which is hosted in google app engine. But when i am trying to display the photourl mapped with the user object, i am getting the http 403 error code.
Do i need additional permission in the app level to access the photourl?
Example photo url: https://scontent.xx.fbcdn.net/v/t1.0-1/s100x100/10354686_10150004552801856_220367501106153455_n.jpg?oh=69aa0ab876bc8904fb59749a5e70382a&oe=598D6773
add referrerpolicy=“no-referrer” to the img tag, it worked for me
It got solved in a strange way. From firebase console when i deleted the user and logged back in the photo url started working fine.
This is the work around by adding no-referrer in referrerpolicy

Error: redirect_uri_mismatch with a google app using the Big Query API?

Hi so I have been trying to make an app that uses a Biq Query API.
All the authentication and client secrets for OAuth2 work fine when I load the app locally, however after deploying the code I get the following error:
Error: redirect_uri_mismatch
Request Details
scope=https://www.googleapis.com/auth/bigquery
response_type=code
redirect_uri=https://terradata-test.appspot.com/oauth2callback
access_type=offline
state=https://terradata-test.appspot.com/
display=page
client_id=660103924069.apps.googleusercontent.com
But looking at my API Console, I find that the redirect uri https://terradata-test.appspot.com/oauth2callback is in my list or redirect uri's:
Redirect URIs:
1.https://terradata-test.appspot.com/oauth2callback
2.http://terradata-test.appspot.com/oauth2callback
3.http://1.terradata-test.appspot.com/oauth2callback
4.https://code.google.com/oauthplayground
I'm not sure what I'm missing to fix this problem? Why is there a redirect error with a uri that is listed in the API console?
The app builds the OAuth2 decorator to pass through to the Biq Query API like this:
CLIENT_SECRETS = os.path.join(os.path.dirname(__file__),
'client_secrets.json')
decorator = oauth2decorator_from_clientsecrets(
CLIENT_SECRETS,
'https://www.googleapis.com/auth/bigquery')
http = httplib2.Http(memcache)
bq = bqclient.BigQueryClient(http, decorator)
Is there any more code I should put to clarify the situation? Any input would be greatly appreciated. Thanks so much!
Shan
In standard web server OAuth 2.0 flows (authorization code), there are 3 places the redirect_uri is used. It must be identical in all three places:
In the URL you redirect the user to for them to approve access and
get an authorization code.
In the APIs console
In the
server-to-server HTTPS post when exchanging an authorization code
for an access token (+ maybe a refresh token)
You haver to create an API credentials with next steps on
https://console.cloud.google.com/apis/credentials
Client Oauth Id
Web Type
JavaScript authorized -> https://yourapp.appspot.com
URIs authorized -> https://yourapp.appspot.com/oauth2callback
This is the credentials you have to use in local app before deploy

Resources