sách gpt4 ăn đã đi

flutter: Không nhận được mã khi đăng nhập Instagram (Đăng nhập Instagram không hoạt động)

In lại 作者:IT王子 更新时间:2023-10-29 07:22:22 31 4
mua khóa gpt4 giày nike

我正在使用 flutter,我想在我的应用程序中实现使用 Instagram 登录。所以我关注这个tutorial用于 Instagram 登录,

我成功登录但未获取用户详细信息,它正在打开重定向 URI ( https://www.google.com/ ) 但未获取代码和访问 token 。

有知道的请帮帮我

Note: I am using flutter_webview_plugin for load webview in flutter.

这是为 Instagram 登录 打开 webview 的代码 ->

我的日志 print("Code ========== Code"); 不再打印了

  Future getToken(String appId, String appSecret) async {

Stream onCode = await _server();
print("_server ========== _server");
Chuỗi url =
"https://api.instagram.com/oauth/authorize?client_id=$appId&redirect_uri=https://www.google.com/&response_type=code";
final flutterWebviewPlugin = new FlutterWebviewPlugin();
flutterWebviewPlugin.launch(url);
final String code = await onCode.first;
print("Code ========== Code");
print("Code -> "+code);
final http.Response response = await http.post(
"https://api.instagram.com/oauth/access_token",
body: {"client_id": appId, "redirect_uri": "https://www.google.com/", "client_secret": appSecret,
"code": code, "grant_type": "authorization_code"});

flutterWebviewPlugin.close();


return new Token.fromMap(json.decode(response.body));
}

Future<>> _server() async {
final StreamController onCode = new StreamController();
HttpServer server =
await HttpServer.bind(InternetAddress.LOOPBACK_IP_V4, 8585);
server.listen((HttpRequest request) async {
final String code = request.uri.queryParameters["code"];
request.response
..statusCode = 200
..headers.set("Content-Type", ContentType.HTML.mimeType)
..write("

You can now close this window

");
await request.response.close();
await server.close(force: true);
onCode.add(code);
await onCode.close();
});
return onCode.stream;
}

câu trả lời hay nhất

iOS 配置如果有人看,将下面的代码添加到 Info.plist

NSAppTransportSecurity

NSAllowsArbitraryLoads
<đúng>
NSExceptionDomains

localhost:8585

NSExceptionAllowsInsecureHTTPLoads
<đúng>
NSIncludesSubdomains
<đúng>



关于 flutter : Not getting code while Instagram login (Instagram login not working),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55063019/

31 4 0
Chứng chỉ ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com
Xem sitemap của VNExpress