简体   繁体   English

验证来自NodeJS的“ Owin OAuth承载令牌”

[英]Validate “Owin OAuth Bearer Token” from NodeJS

I am creating an App in Angular that connects to two APIs. 我正在Angular中创建一个连接到两个API的应用程序。 The first API was developed in C# .NET and, among other things, is the responsible for handle the authentication based in Owin OAuth2. 第一个API是在C#.NET中开发的,除其他外,它负责处理基于Owin OAuth2的身份验证。 When the user log-in the API gives a token. 用户登录时,API会提供令牌。

I am creating the second API in NodeJS...and i want to use the token from C# API to access the NodeJS API. 我正在NodeJS中创建第二个API ...我想使用C#API中的令牌来访问NodeJS API。

The tokens aren't stored in DB, so i need to "validate" this in the NodeJS API. 令牌没有存储在数据库中,因此我需要在NodeJS API中对此进行“验证”。

Is that possible? 那可能吗?

Thanks in advance! 提前致谢!

You can get token from C# API by using http.request and then validate it. 您可以使用http.request从C#API获取令牌,然后对其进行验证。

var options = {
    path: '<API path that gives token>',
    method: 'GET'
};

http.request(options, function (res) {
    res.setEncoding('utf8');
    res.on('data', function (data) {
        console.log(data);
    });
}).end();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM