卷曲在flitter中

发布于 2025-02-09 19:21:37 字数 954 浏览 2 评论 0原文

如果有人可以解释如何在Flitter中使用以下代码,我将非常感谢。

curl -k -d“ grant_type = password& username =用户名& password =密码”
-h“授权:基本基础64(消费者密钥:消费者销售)”

https://devesb.elicia.systems:8263/token 使用密码授予类型生成访问令牌。

那就是他们所说的,然后我得到了这一点:

curl -k -X POST "https://devesb.vfdbank.systems:8263/vfd-wallet/1.1/wallet2/onboarding?wallet-credentials=wallet-credentials" -H "accept: application/json" -H "Content-Type: application/json" -H "Authorization: Bearer c9b84e30-e59a-3789-b6d1-3595552dfb23" -d "{ \"username\": \"Username used to signup\", \"walletName\": \"Company/Wallet name\", \"webhookUrl\": \"Inward notifications Webhook\", \"shortName\": \"Wallet short name (4 Characters)\", \"implementation\": \"POOL or 1-1\"}"

还为消费者密钥和消费者秘密钥匙提供了。您能帮我构建上述卷发(我被给予的卷发),并告诉我在哪里添加消费者和秘密钥匙。已经有几个星期了,如果您能帮助我,我将非常感激。

Please I would really appreciate if anyone can explain how to use the below code in flitter.

curl -k -d "grant_type=password&username=Username&password=Password"
-H "Authorization: Basic Base64(consumer-key:consumer-secret)"
https://devesb.elicia.systems:8263/token

The above cURL command shows how to generate an access token using the Password Grant type.

That was what they said, Then I was given this:

curl -k -X POST "https://devesb.vfdbank.systems:8263/vfd-wallet/1.1/wallet2/onboarding?wallet-credentials=wallet-credentials" -H "accept: application/json" -H "Content-Type: application/json" -H "Authorization: Bearer c9b84e30-e59a-3789-b6d1-3595552dfb23" -d "{ \"username\": \"Username used to signup\", \"walletName\": \"Company/Wallet name\", \"webhookUrl\": \"Inward notifications Webhook\", \"shortName\": \"Wallet short name (4 Characters)\", \"implementation\": \"POOL or 1-1\"}"

was also given a consumer key and consumer secret key. Could you please help me structure the above curl (The one I was given) and tell me where to add the consumer and secret keys. Have been on this for weeks now and I would be so very grateful if you could help me out on this.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

依 靠 2025-02-16 19:21:37

您需要使用 http package

这是您的代码的或多或少直接的翻译:

// Required for base64encode and utf8 encoding
import 'dart:convert';

import 'package:http/http.dart' as http;

void forExample() async {
  final testUsername = 'username';
  final testPassword = 'password';

  final uri = Uri.parse('https://devesb.elicia.systems:8263/token');

  final token = base64Encode(utf8.encode('$testUsername:$testPassword'));

  final response = await http.post(
    uri,
    headers: { 
      'Authorization': 'Basic $token',
    },
    body: {
      'grant_type': 'password',
      'username': testUsername,
      'password': testPassword,
    },
  );

  print(response.body);
}

注意:在上面的代码中,请求主体将自动编码为X-WWW-Form-urlCorm-urlenCod编码,如您的卷发请求中。

You'll need to use the http package.

Here is a more or less straightforward translation of your code:

// Required for base64encode and utf8 encoding
import 'dart:convert';

import 'package:http/http.dart' as http;

void forExample() async {
  final testUsername = 'username';
  final testPassword = 'password';

  final uri = Uri.parse('https://devesb.elicia.systems:8263/token');

  final token = base64Encode(utf8.encode('$testUsername:$testPassword'));

  final response = await http.post(
    uri,
    headers: { 
      'Authorization': 'Basic $token',
    },
    body: {
      'grant_type': 'password',
      'username': testUsername,
      'password': testPassword,
    },
  );

  print(response.body);
}

Note: In the above code, the request body will be automatically encoded as x-www-form-urlencoded, as in your curl request.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文