passport-linkedin-oauth2 upgrade to Linkedin API v2 with r_liteprofile in scope - passport.js

I am trying to retrive lite profile of a user using passport-linkedin-oauth2 and am passing r_liteprofile as scope, all the fields except email are being returned as undefined.
Please help with the migrations required in passport-linkedin-oauth2 that are required as per Linkedin API v2.
https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/migration-faq

If you are using V2 and you did not taken permission to use r_basicprofile
then either apply for permission to use r_basicprofile to linkedin
or use r_liteprofile + r_emailaddress
r_liteprofile for firstName,lastName,profilePicture,id - https://api.linkedin.com/v2/me?projection=(id,firstName,lastName,profilePicture(displayImage~:playableStreams))
r_emailaddress for getting emailAddress - https://api.linkedin.com/v2/emailAddress?q=members&projection=(elements*(handle~))
Check this : https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/migration-faq?context=linkedin/consumer/context

Related

The provided value for the input value scope is not valid for OnlineMeeting.ReadWrite

I am trying to create meeting on behalf of a user for that I am trying to get the code. I have registered the app on Azure. Also generated Application(Client) ID I have also added the required permission in the API. But when I am visiting this page the page asks for the email id but once the users fill the email id it says The provided value for the input value scope is not valid for OnlineMeeting.ReadWrite in the redirect URL.
Please guide me to know what I am missing here.
Edit 1: As suggested by #Rukmini I tried this and here is the relevant details.
To obtain the the code I am building url like this image
This does not work when I pass the OnlineMeetings.ReadWrite scope. But when I pass https://graph.microsoft.com/.default as scope it works and I am able to authenticate and generate a code. Then I can use that code to get the access token like following image. But using this access token I can not create the meeting as it does not have the OnlineMeetings.ReadWrite scope as stated in this doc **https://learn.microsoft.com/en-us/graph/api/application-post-onlinemeetings?view=graph-rest-1.0&tabs=http**[![enter image description here]3]3
Let me know what I can do to generate code and access token for the OnlineMeetings.ReadWrite scope so that I can create the meeting on users behalf. Thanks
EDIT 2: I generated the authorization URL as suggested by #Rukmini using the following query parameters.
When I visited the link, I was presented with a login screen but as my previous error I see the same screen. Am I missing something here? Do I need to verify my app? Or Do I have to only use some specific IDs like we do in GCP and AWS?
Please let me know what I am missing here.
Thanks
I tried to reproduce the same in my environment and got the results successfully like below:
I created an Azure AD Multi-Tenant Application:
I granted Admin Consent to the API permissions like below:
I generated the code by using below endpoint and authorizing it via browser:
https://login.microsoftonline.com/common/oauth2/v2.0/authorize?
&client_id=ClientID
&response_type=code
&redirect_uri=https://jwt.ms
&response_mode=query
&scope=OnlineMeetings.ReadWrite
&state=12345
Now, I generated access token by using the below parameters:
https://login.microsoftonline.com/common/oauth2/v2.0/token
client_id:ClientID
client_secret:ClientSecret
scope:OnlineMeetings.ReadWrite
grant_type:authorization_code
redirect_uri:https://jwt.ms
code:code
Decode the access token using jwt.ms and check whether the scope is OnlineMeetings.ReadWrite:
I am able to create the Online meetings successfully by using the below query:
https://graph.microsoft.com/v1.0/me/onlineMeetings
Content-Type: application/json
{
"startDateTime":"2023-01-12T14:30:34.2444915-07:00",
"endDateTime":"2023-02-12T15:00:34.2464912-07:00",
"subject":"User Token Meeting"
}

AADSTS7000014: The provided value for the input parameter 'device_code' is not valid Microsoft Graph

I want to get the microsoft user token using the msal-node nodejs module.
I don't know why i receive this error so if someone have a little idea ;-;:
Error code
I tried to retrieve the user microsoft token by using the acquireTokenByDeviceCode msal's function. code sample
The PublicClientApplication object contain clientId (from the azureAD panel) and authority (https://login.microsoftonline.com/consumers) informations.
Thanks in advance ^^
When you try to request a new access token, use this scope [https://graph.microsoft.com/.default](https://graph.microsoft.com/.default)
All Client Credentials requests on the v2 endpoint must include scope={resource}/.default where {resource} is the API which the app intends to call.
References: c# - AADSTS70011: The provided value for the input parameter 'scope' is not valid - Stack Overflow, Application permission 'scopes' · Issue #36432 · MicrosoftDocs/azure-docs · GitHub and Cannot get access token for scope https://graph.microsoft.com/User.ReadWrite.All · Issue #449 · AzureAD/microsoft-authentication-library-for-dotnet · GitHub

Access sharepoint\office 365 using CSOM and grant_type=client_credentials

I have followed the instructions in this example:
https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/using-csom-for-dotnet-standard
And can connect fine :-) using grant_type=password, username and password
However i want to connect using client id and client secret...
I have set these up in AzureAD
i have added the permissions:
i have exposed the api
this is the body of my request
at this point in the code i actually receive the token
but here it fails with a 401
i wonder if someone has an example of this working?
I have also tried this https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/security-apponly-azureacs
and i can get it working, whoever according to the documentation this has been retired on November 7, 2018.
I not sure what auth method it uses or how to identify the auth method.
If this registration is only used for SharePoint, you do not need to expose an API.
You don't need scope. You will need to pass in the 'client_id' and 'resource' like below and it will look something similar to this for getting a token to make a call to SharePoint:
client_id: [appRegistrationClientId]#[tenantid]
Resource: 00000003-0000-0ff1-ce00-000000000000/[tenant].sharepoint.com#[tenant-id]
This will help too: https://anexinet.com/blog/getting-an-access-token-for-sharepoint-online/

Getting the right token for embedding PowerBi Angular 8

I am following this example to embed report in Angular 6 app. I need to make some tweeks to make it work on Angular 8.
https://www.c-sharpcorner.com/article/how-to-embed-powerbi-report-in-angular-6/
The last thing was the access token.
To get the short term token I used Postman with the following endpoint:
https://login.microsoftonline.com/38efd35e-da65-4e47-8656-876039ad15b1/oauth2/token
Where 38efd35e-da65-4e47-8656-876039ad15b1 is my TenantId.
I provided App ID and client_secret. The resource is https://analysis.windows.net/powerbi/api
I am able to generate token with the call.
The Report ID is in new Workspace. In the access control, app ID is added as administrator (Service Principal). In the code I am providing Report Id and Group ID.
The App has permission for Power Bi service.
When I use the token generated in Postman as access_token I get 403 error displayed in the Angular Console.
What I could be doing wrong? What is missing?
Is it a wrong Bearer Token? Should I use something else?
MS does not provide clear step by step guide for the process.
Preferably I would like to stick to Javascript/typescript stack and not involve .NET or C#.
The answer is yes, you are missing one step that is generating embed token using access token that you have generated on Postman. Instead of using access token directly to embed your report, you need to use embed token because you are using Service Principal as a method for embedding.
And you also need to provide the type of token to be used for embedding in embed config as following:
var models = window['powerbi-client'].models;
var config = {
type: 'report',
tokenType: models.TokenType.Embed,
accessToken: accessToken,
embedUrl: embedUrl,
id: embedReportId,
settings: {}
};
Since 'service principal' and 'master user' falls under 'Embed for your customers' where embed token must be generated. Whereas, if you want to use only access token, you can use 'Embed for your organization' where user (with pro account) needs to sign-in (if not already) for generating access token.
You can refer this link to understand embedding with Power BI.
There are two type of embedding, you can refer to these links:
Embedding for your organization
Embedding for your customers
You can also refer to this all new sample created on React technology for 'embed for your organization' embed type.

Get teams where the user is member, using Bitbucket API

How can I get a JSON object with teams (organizations) where the user is member?
I am searching in documentation and in Bitbucket REST API Console.
Basically I need the correspondent for orgs.getFromUser function from Github API where I pass the username after authenticating.
I think you're looking for this endpoint.
You provide the accountname and authenticate for it, and GET /1.0/groups/:accountname/. It will return a list of objects displayed on the documentation page.
Use the "User Endpoint" for API 1.0
https://confluence.atlassian.com/display/BITBUCKET/user+Endpoint
The call your looking for is: https://bitbucket.org/api/1.0/user/privileges
You need to call this with user authenticated:
curl -u "USER_NAME:USER_PASSWORD" https://bitbucket.org/api/1.0/user/privileges
This will return a list of teams:
{u'teams': {u'team1': u'admin', u'team2': u'admin'}}

Resources