How can I add a dedicated Slack channel to a Jira Issue using the Jira REST Api? - slack-api

How can I add a dedicated Slack channel to a Jira Issue using the Jira REST Api?
I try the requests from the web page but I am not successful.
E.g. https://jira.url/rest/slack/latest/oauth/begin/XXXX
returns 500.
It obviously requires oAuth but I fail on the first step. Probably there is a separate way for the REST Api.
I am using a bearer token authentication.
The direct POST request https://jira.url/slack/dedicatedchannel requires preliminary oAuth request to Slack to allow it.

Related

azure logic app http webhook with OAuth authentication

We would like to create a logic app that subscribes to a webhook in Microsoft Graph. To enable this subscription you need to include a bearer token. Something the logic app included HTT webhook does not seem to provide. Is there someone who has got this working somehow? We would like to subscribe to the 'calldetailrecords'
One of the workaround is that you can use Subscribe-Header parameter from Add new parameter in order to send the Bearer Token to your Webhook.
Here is the screenshot for your reference
So, I'm passing the Token from my HTTP request connector and adding the same to my Subscribe- Header parameter with Key as "Authentication".
To get the Bearer Token you can follow the steps from Get access on behalf of a user - Microsoft Graph
REFERENCES:
How to pass a Bearer Token using Azure Logic Apps

Jira Login with REST

I want to work with Jira using it's REST API but before that I want to do a login with REST API. So far I can find that Login can be done with username and api key token. But I don't want to create API token from portal.
So seeking suggestions if we can create API token from API itself or can do login some way.
As per Atlassian's official documentation, There are multiple ways to authenticate with JIRA. The way you are looking to use is using cookie based authentication.
This is how cookie-based authentication works in Jira at a high level:
- The client creates a new session for the user via the Jira REST API.
- Jira returns a session object that has information about the session including the session cookie. The client stores this session object.
- The client can now set the cookie in the header for all subsequent requests to the Jira REST API.

Jira/Atlassian Java Service Desk API - best way to handle authenticating customers/service desk user accounts on a reporting application?

Currently working on a service desk application that allows service desk users on our system to see more than they currently can on Jira. What i'm wanting to do is allow them to be able to comment on tickets and possibly add further tickets. I am currently doing this through basic auth, with a 3 legged auth I have made, that uses a jira account to pull tickets for them to see, and then their login to authenticate and then be able to comment on tickets. My issue is that I am having to re-authenticate each time, meaning i have to store the password in a static string somewhere after they have entered it to initially login. I have looked at the api documentation and as far as i can work out Oauth 2.0 is not an option (believe i read that its not supported for customer support desk users), and i cannot get api keys easily for them (if at all) as I would need system admin to generate api keys for all users and then it would be difficult to code.
Storing user password seems wrong, even as a char array. Any help would be massively appreciated!
Storing passwords in active session is not the best method, but it does the Job.
In our application we applied the following:
When user is authenticated the first time Jira sends back a response with a cookie that may look like this:
JSESSIONID=6AD97CC4450456CD968B22F7201220A7; atlassian.xsrf.token=BWP3-NZB2-6EDY-6C7K_d3ec7ed6f227879ac4cf6aee83f28e085e49227b_lin
We stored the user's cookie in their session and we use it every time we send a API request to Jira rest api on their behalf
As cookie is a valid authentication method for Jira service desk api.
Authentication
The JIRA Service Desk REST API uses the same authentication methods as
JIRA. The preferred authentication methods are OAuth and HTTP Basic
Auth (when using SSL). Other supported methods include: HTTP Cookies
and Trusted Applications.
Authentication in Jira Service-desk rest
Proof of Concept
Using postman, send an authenticated request to Jira using basic auth
After getting a 200 response, alter the Authorization in postman and change it from Basic Auth to No Auth and retry the same request.
You should be able to see the same result and if you expand the request headers, you'll find that postman has injected the cookie that was retrieved from the first basic auth request
Hope this helps.

Outlook add-in Rest Api token to get the SharePoint Rest Api Token

I am building a Outlook Add-in using Node JS and it needs get information from SharePoint Online using SharePoint Rest Api because Graph does`t have an option to get the required information.
Question?
I need a SharePoint online auth token to call SP Rest Api which I am getting using OAuth flow (implicit flow) after user enters credentials.
Is there a way to get the SharePoint online auth token using Outlook Rest Api returned by getCallbackTokenAsync() or getUserIdentityTokenAsync() or "getAccessTokenAsync()" method?
if you only need the SharePoint REST API Token (I assume you mean the one with URLs starting with _api/[...]) then your best bet is to get that token from the /_api/contextinfo endpoint for your site. You do not need the Outlook REST API to do so if I understand the question correctly. So you need to craft a POST request to:
http://yourspsite/_api/contextinfo
Headers:
accept: application/json
content-type: application/json
Get the token value from the returned JSON: e.g. jsonResponse.FormDigestValue
The FormDigestValue field contains the value you want.
There ya go, hope this helps.
Cheers,
Razvan
UPDATE regarding NodeJS in Outlook Add-in:
As you correctly pointed out I left out the requirement that the token be obtained from within the Addin itself. This is currently only possible from within SSO addins (preview). See the following link for how to implement it and use getAccessTokenAsync to get an Azure AD V2 token: https://learn.microsoft.com/de-de/office/dev/add-ins/develop/sso-in-office-add-ins
Make sure to have created the AzureAD V2 App beforehand using https://apps.dev.microsoft.com
Give the app the necessary permissions for the operation e.g. Sites.Read.All for reading items in all site collections.
The resource for the token should look like:
https://[yourtenant].sharepointonline.com/
Caveat: To create an SSO Addin you currently need to be part of the Office Insider Program at: https://products.office.com/de-DE/office-insider - signup required.
Finally: Use the token to call the regular SharePoint REST API, it should accept it if you stick to operations within the permissions you set in the Azure App above.

Link the api.ai agent to Facebook

I am creating an api agent and I wanted to add functionality to the webhook to be able to talk to Facebook graph api. In order to do that, I want the specific intent to require a sign-in to Facebook before calling the webhook. That way it would have the token to make the API calls to Graph API.
Any idea how I can do that?
I cannot find the authorization url, token url and client secret needed for OAuth linking.
Currently, you have to own the OAuth endpoint for it to work with actions, so using the Facebook OAuth is not supported.

Resources