typed-rest-client | Node Rest and Http Clients | REST library
kandi X-RAY | typed-rest-client Summary
kandi X-RAY | typed-rest-client Summary
Node Rest and Http Clients with typings for use with TypeScript
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of typed-rest-client
typed-rest-client Key Features
typed-rest-client Examples and Code Snippets
Community Discussions
Trending Discussions on typed-rest-client
QUESTION
I'm having a problem where a certain import fails to work when compiling directly, but works okay after saving the source on VS Code.
If I delete the node_modules/.cache
folder and execute the command:
ANSWER
Answered 2020-Mar-02 at 13:56Managed to fix everything by setting "esModuleInterop": true
on tsconfig.json
and effecting the required imports as getParamNames from 'get-param-names'
.
After that, both vue-cli
and es-node-dev
started building the code consistently; in addition, Jest also required a bit more of type information on its unit tests, but worked okay, afterwards.
QUESTION
I am trying to create a chat bot using the microsoft botframework and the SDK in typescript. I am trying to have the bot authenticate users and then interact with Azure DevOps on their behalf. However, while I am able to test authentication successfully in Azure portal, when I try to authenticate the user in Teams, the login "succeeds", but the bot returns a 401 error trying to hit the Azure DevOps API's.
I am new to a lot of the microsoft stack, and was following the guide here: https://docs.microsoft.com/en-us/azure/bot-service/bot-builder-authentication?view=azure-bot-service-4.0&tabs=javascript%2Cbot-oauth.
First, I have created my Bot Channels Registration. It has an App Registration associated with it (that was manually created). The appId and secret are set up as environment variables in the App Service on Azure Portal.
Second, I have created another App Registration for my Azure Devops authorization. This app registration has a redirect URI of "https://token.botframework.com/.auth/web/redirect", and has a secret created for it. This app registration also is setup to have the API permissions "user_impersonation" for Azure Devops.
Third, I have gone into my Bot Channels Registration, clicked on the "Settings" blade, and configured an OAuth Connection Setting. This setting has the name "azureDevopsOauth", is setup for an Azure Active Directory V2 service provider, and includes the client id, secret and tenant ID of the app registration I made in the second step. It also has the scope set to "openid".
When I click "Test Connection" at the top of this oauth configuration, everything works fine. I am taken to a success page, and am able to view a token there.
Moving on to the code, I know teams is a bit funky with OAuth. My application is written in typescript using node and restify to handle the server aspect. My bot code, which extends the ActivityHandler, has the usual onMembersAdded, onMessage and onDialog functions. I've also added an onTokenResponseEvent and onUnrecognizedActvityType to handle the token response and invoke activity type.
...ANSWER
Answered 2019-Sep-17 at 21:37I think this has to do with the way that Teams handles actvities differently. Here is a bit more info from a Node sample:
At this stage the primary focus of this sample is how to use the Bot Framework support for oauth in your bot. The reason for prioritizing this is that Teams behaves slightly differently than other channels in this regard. Specifically an Invoke Activity is sent to the bot rather than the Event Activity used by other channels. This Invoke Activity must be forwarded to the dialog if the OAuthPrompt is being used. This is done by subclassing the ActivityHandler and this sample includes a reusable TeamsActivityHandler. This class is a candidate for future inclusion in the Bot Framework SDK.
My suggestion is to test this Node sample quickly to see if you can get it working in Teams. Then you should be able to take the approach from the Node sample and apply it to TypeScript (there currently not a sample for TypeScript).
QUESTION
See the library here https://github.com/Microsoft/azure-pipelines-task-lib/blob/master/node/docs/azure-pipelines-task-lib.md
I'm using this to create a minimal release task, which I can succesfully call into.
In this task, I call const myUrl: string = tl.getEndpointUrl('myEndpoint', true);
How can I then make a web request using this url?
I've tried import * as rm from 'typed-rest-client/RestClient';
and using the rest client, but when I run this on the Azure devops build agent, I get the output:
...##[error]Unhandled: Cannot find module 'typed-rest-client/RestClient'
ANSWER
Answered 2019-Apr-02 at 20:46I needed to ensure npm install typed-rest-client --save
was run from within the same folder as my .ts
file was located in to ensure it was packaged as part of the node_modules
that I uploaded.
QUESTION
I want to add some headers to a request using typed-rest-client in Typescript.
I didn't find any documentation so I looked a bit at typed-rest-client source code but I didn't manage to fully understand how it works.
I've tried the following code, but I get the error: "ReferenceError: Headers is not defined". So I don't think I have to create an instance of the class Headers.
...ANSWER
Answered 2018-Dec-24 at 18:19you need to use IRequestOptions
which is stated below.
QUESTION
I'm very new to Typescript and developing my first Electron based application. The first part is a class that populates a local DB with results from a json web service.
My Classes to get the data are as below, an extended class. Within the getAll, if I console out the body after JSON.parse I can see my results in my console without a problem.
...ANSWER
Answered 2018-Aug-01 at 11:43In this line:
QUESTION
My backend is an ASPNet WebApi2 running under IIS and uses Windows Authentification
.
I have 2 clients:
WinForms: Passing the credentials is simple. I do the following:
...
ANSWER
Answered 2018-May-13 at 12:18Here you can find the library: https://github.com/zorgoz/Http.BasicWindowsAuthentication
Note: it is not "released" yet, and it was designed and tested with self-host, not IIS integration, and never thought about having multiple authentication methods in parallel. Still, it could work even without modification.
As mentioned in the comments you could try using only IIS. Even if only Windows authentications is enabled and basic is not, if ntlm/keberos fails, it will fall back to some sort of basic. A browser would display the login dialog. And if you pass username and password, it will authenticate as it would be regular Windows authentication. As I said, you could add proper header up front in your ajax request, then you should not see the challenge. More here. The above mechanism should work transparently - although I never tried it.
If you want to use my middleware, you have to decide where to put it in the pipeline. Use UseStageMarker for that (more here). You will notice, that the middleware can provide feedback on the cause of a login failure. If you want it will add two header entries in the response, which you can inspect and display to the user in your Angular client.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install typed-rest-client
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page