Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Ondrej Tomcik
    @ondrejtomcik
    @WAvdBeek are you using secure or unsecure device?
    Wouter
    @WAvdBeek
    secure devices
    Wouter
    @WAvdBeek
    test
    plgd
    coaps+tcp://192.168.178.85:8443
    00000000-0000-0000-0000-000000000001
    and then the callback indicates failure of the registration.
    ok at least the mediator that I have coded up is now working.
    Ondrej Tomcik
    @ondrejtomcik
    You have wrong port. It’s not 8443. CoAP gateway is accessible on 5684
    5 replies
    Martin Eliáš
    @melias122
    @ondrejtomcik I will take a look there.
    Yorick Coleu
    @YorickColeu

    Hi, I'm trying to use the plgd/bundle:v2next with an OAuth provider for user authentication. I followed the "How to congigure Auth0" tutorial here: https://plgd.dev/guide/getting-started/1-deploy.html#bundle
    I have set the following env variables:

    ENDPOINT_OAUTH_DOMAIN: The domain suggested by Auth0 for my account, found in "Domain" field of regular_web or m2m application
    PLGD_DOMAIN: The domain where plgd_cloud can be reached, in my case, this redirect to my local computer IP address.
    REGULAR_WEB_CLIENT_ID: The Auth0 regular_web app "Client ID"
    M2M_CLIENT_ID: The Auth0 m2m app "Client ID"
    M2M_CLIENT_SECRET: The Auth0 m2m app "Client Secret"

    I have also configured the plgd.mobile app with the following variables in appConstants.dart:

    static Uri defautPlgdCloudEndpoint = Uri.parse('https://<PLGD_DOMAIN>' + cloudConfigurationPath);

    I have also set up the sentryDSN variable with my own sentry token.

    Then I run the plgd cloud solution with the following command:

    docker run -d \
    --name plgd \
    -p 443:443 \
    -p 5683:5683 \
    -p 5684:5684 \
    -e FQDN=${PLGD_DOMAIN} \
    -e OAUTH_ENDPOINT=${ENDPOINT_OAUTH_DOMAIN} \
    -e OAUTH_AUDIENCE=https://${PLGD_DOMAIN}/ \
    -e OAUTH_ENDPOINT_AUTH_URL=https://${ENDPOINT_OAUTH_DOMAIN}/authorize \
    -e OAUTH_ENDPOINT_TOKEN_URL=https://${ENDPOINT_OAUTH_DOMAIN}/oauth/token \
    -e JWKS_URL=https://${ENDPOINT_OAUTH_DOMAIN}/.well-known/jwks.json \
    -e OAUTH_CLIENT_ID=${REGULAR_WEB_CLIENT_ID} \
    -e SERVICE_OAUTH_CLIENT_ID=${M2M_CLIENT_ID} \
    -e SERVICE_OAUTH_CLIENT_SECRET=${M2M_CLIENT_SECRET} \
    plgd/bundle:v2next

    By doing so, I have access to the Oauth webview provided by Auth0 through the plgd mobile app, but once I have entered by Google login/password, the webview just froze indefinetly with the blue waiting circle.

    I have the following Flutter error, but I'm not sure this is relevant:

    ```
    03-22 09:04:32.940 2699 2718 E flutter : [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: NoSuchMethodError: The method 'call' was called on null.
    03-22 09:04:32.940 2699 2718 E flutter : Receiver: null
    03-22 09:04:32.940 2699 2718 E flutter : Tried calling: call()
    03-22 09:04:32.940 2699 2718 E flutter : #0 Object.noSuchMethod (dart:core-patch/object_patch.dart:51:5)
    03-22 09:04:32.940 2699 2718 E flutter : #1 _OAuthHandlerState.build.<anonymous closure>.<anonymous closure> (package:client/components/oauthHandler.dart:91:46)
    03-22 09:04:32.940 2699 2718 E flutter : #2 InAppWebViewController.handleMethod (package:flutter_inappwebview/src/in_app_webview_controller.dart:103:30)
    03-22 09:04:32.940 2699 2718 E flutter : #3 MethodChannel._handleAsMethodCall (package:flutter/src/services/platform_channel.dart:430:55)
    03-22 09:04:32.940 2699 2718 E flutter : #4 MethodChannel.setMethodCallHandler.<anonymous closure> (package:flutter/src/services/platform_channel.dart:383:34)
    03-22 09:04:32.940 2699 2718 E flutter : #5 _DefaultBinaryMessenger.handlePlatformMessage (package:flutter/src/services/binding.dart:283:33)
    03-22 09:04:32.940 2699 2718 E flutter : #6 _invoke3.<anonymous closure> (dart:ui/hooks.dart:280:15)
    03-22 09:04:32.940 2699 2718 E flutter : #7 _rootRun (dart:async/zone.dart:1190:13)

    <Rest of Flutter error trace:>

    03-22 09:04:32.940  2699  2718 E flutter : #8      _CustomZone.run (dart:async/zone.dart:1093:19)                                                                                                                  
    03-22 09:04:32.940  2699  2718 E flutter : #9      _CustomZone.runGuarded (dart:async/zone.dart:997:7)                                                                                                             
    03-22 09:04:32.940  2699  2718 E flutter : #10     _invoke3 (dart:ui/hooks.dart:279:10)                                                                                                                            
    03-22 09:04:32.940  2699  2718 E flutter : #11     _dispatchPlatformMessage (dart:ui/hooks.dart:154:5)

    What did I do wrong? Thanks in advance for your help.

    Wouter
    @WAvdBeek
    About: u have wrong port. It’s not 8443. CoAP gateway is accessible on 5684
    POST response: CHANGED
    {"rt":["oic.r.coapcloudconf"],"if":["oic.if.rw","oic.if.baseline"],"apn":"plgd","cis":"coaps+tcp://192.168.178.85:5684","sid":"00000000-0000-0000-0000-000000000001","clec":2,"cps":"readytoregister"}
    it still give me the connection status error on the device side.
    Wouter
    @WAvdBeek
    I am starting docker with: docker run --rm -it -e NGINX_PORT=8443 -p 8443:8443 -p 5683:5683 -p 5684:5684 -e FQDN=192.168.178.85 plgd/bundle:v2next-d55f695
    mentions: apn test
    also tried that and also does not work
    Ondrej Tomcik
    @ondrejtomcik
    @YorickColeu are you building the mobile app on your own? That's not needed. When you run the plgd mobile app, you can set endpoint of your own bundle and it shall work.
    Or are you e.g. branding the mobile app and that's why you want to have your own build of the app?
    This message was deleted
    This message was deleted

    @WAvdBeek

    https://github.com/plgd-dev/cloud/tree/v2/bundle

    Sorry, that one is outdated. documentation is part of the /doc, that's what is available on plgd.dev web. So "plgd" is correct.

    Are you using mobile app to onboard the device @WAvdBeek connected to your bundle or your self-made proxy-aware go client?
    Wouter
    @WAvdBeek
    onboarding with the pldg app works, i am adapting the onboarding tool so that has the cloud mediator features
    Ondrej Tomcik
    @ondrejtomcik
    Best would be to share the code of your onboarding-tool @WAvdBeek
    Ondrej Tomcik
    @ondrejtomcik
    It's not only about setting coapcloudconf resource. It's also about having right certificates, but if you're using SDK in a same way as we do in the plgd.mobile, it should work. And setting ACLs.
    Yorick Coleu
    @YorickColeu
    Hi Ondrej, thanks for your response. I use devices that don't have Google Play Store, so I tried to retrieved the APK using APKPure application. I successfully retrieved the plgd.dev app with the following version: Nov 25 2020, version: 1.0.1 (6).
    Ondrej Tomcik
    @ondrejtomcik
    Ok, and this one is not working?
    Yorick Coleu
    @YorickColeu
    Actually using that version, It's worse. When I press the "Continue with Google button", I get the following error:
    ```
    03-22 13:13:07.313 6560 6578 E flutter : [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: Null check operator used on a null value
    03-22 13:13:07.313 6560 6578 E flutter : #0 _AndroidMotionEventConverter.toAndroidMotionEvent.<anonymous closure> (package:flutter/src/services/platform_views.dart:601)
    03-22 13:13:07.313 6560 6578 E flutter : #1 MappedListIterable.elementAt (dart:_internal/iterable.dart:417)
    03-22 13:13:07.313 6560 6578 E flutter : #2 ListIterator.moveNext (dart:_internal/iterable.dart:343)
    03-22 13:13:07.313 6560 6578 E flutter : #3 new List.from (dart:core-patch/array_patch.dart:38)
    03-22 13:13:07.313 6560 6578 E flutter : #4 new List.of (dart:core-patch/array_patch.dart:68)
    03-22 13:13:07.313 6560 6578 E flutter : #5 ListIterable.toList (dart:_internal/iterable.dart:102)
    03-22 13:13:07.313 6560 6578 E flutter : #6 _AndroidMotionEventConverter.toAndroidMotionEvent (package:flutter/src/services/platform_views.dart:602)
    03-22 13:13:07.313 6560 6578 E flutter : #7 AndroidViewController.dispatchPointerEvent (package:flutter/src/services/platform_views.dart:864)
    03-22 13:13:07.313 6560 6578 E flutter : #8 _GrowableList.forEach (dart:core-patch/growable_array.dart:313)
    03-22 13:13:07.313 6560 6578 E flutter : #9 _PlatformViewGestureRecognizer._flushPointerCache (package:flutter/src/rendering/platform_view.dart:560)
    03-22 13:13:07.313 6560 6578 E flutter : #10 _PlatformViewGestureRecognizer.acceptGesture (package:flutter/src/rendering/platform_view.dart:542)
    03-22 13:13:07.313 6560 6578 E flutter : #11 _CombiningGestureArenaMember.acceptGesture (package:flutter/src/gestures/team.dart:42)
    03-22 13:13:07.313 6560 6578 E flutter : #12 GestureArenaManager.sweep (package:flutter/src/gestures/arena.dart:157)
    03-22 13:13:07.313 6560 6578 E flutter : #13 GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:362)
    03-22 13:13:07.313 6560 6578 E flutter : #14 GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:338)
    03-22 13:13:07.313 6560 6578 E flutter : #15 RendererBinding.dispatchEvent (package:flutter/src/rendering/binding.dart:267)
    03-22 13:13:07.313 6560 6578 E flutter : #16 GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:295)
    03-22 13:13:07.313 6560 6578 E flutter : #17 GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:240)
    03-22 13:13:07.313 6
    The rest of error:
    03-22 13:13:07.313 6560 6578 E flutter : #18 GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:213)
    03-22 13:13:07.313 6560 6578 E flutter : #19 _rootRunUnary (dart:async/zone.dart:1206)
    03-22 13:13:07.313 6560 6578 E flutter : #20 _CustomZone.runUnary (dart:async/zone.dart:1100)
    03-22 13:13:07.313 6560 6578 E flutter : #21 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1005)
    03-22 13:13:07.313 6560 6578 E flutter : #22 _invoke1 (dart:ui/hooks.dart:265)
    03-22 13:13:07.313 6560 6578 E flutter : #23 _dispatchPointerDataPacket (dart:ui/hooks.dart:174)
    Ondrej Tomcik
    @ondrejtomcik
    Easiest is to use just go client from the plgd.mobile repository and do it from the console. OR buy cheapest Samsung phone :)
    Wouter
    @WAvdBeek
    if I need another certificate, how to obtain that?
    I am setting the ACL to configure the coap cloud config, and that works..
    so what kind of info that is not being set by coapcloudconfig is needed to talk to the plgd bundle?
    Jozef Kralik
    @jkralik
    @WAvdBeek There are 3 ways how to obtain RootCA certificate:
    • via file : docker exec -it cloud cat /data/certs/root_ca.crt > pki_certs/cloudca.pem
    • via web: GET https://${FQDN}:${NGINX_PORT}/.well-known/ocfcloud-configuration and it stored under property: cloud_certificate_authorities. eg https://try.plgd.cloud/.well-known/ocfcloud-configuration
    • via tls connection: openssl s_cllient -connect ${FQDN}:5684 -showcerts and the last certificate of chain is RootCA of cloud
    Wouter
    @WAvdBeek
    thanks!, how do I get that pem file into my code without compiling?
    Jozef Kralik
    @jkralik
    @WAvdBeek if you have stored it (eg option 1) you can read it from the file. This is the simplest way.
    Wouter
    @WAvdBeek
    @jkralik can you give me the steps in how the plgd app is configuring the device talking to the cloud?
    Jozef Kralik
    @jkralik

    @WAvdBeek at the start plgd.app (first page) you can select domain of cloud where you want to onboard the device (eg try.plgd.cloud / bundle FQDN). After that app download https://DOMAIN/.well-known/ocfcloud-configuration and this configuration is used during onboard the device to the cloud.
    The process of onboard the device the cloud:

    1. own the device (https://github.com/plgd-dev/plgd.mobile/blob/master/ocfclient/OCFClient.go#L107)
    2. move to provision mode (https://github.com/plgd-dev/plgd.mobile/blob/master/ocfclient/OCFClient.go#L124)
    3. set ACLs for access from cloud (https://github.com/plgd-dev/plgd.mobile/blob/master/ocfclient/OCFClient.go#L149)
    4. set RootCA for communication with cloud (https://github.com/plgd-dev/plgd.mobile/blob/master/ocfclient/OCFClient.go#L158)
    5. move to normal mode(https://github.com/plgd-dev/plgd.mobile/blob/master/ocfclient/OCFClient.go#L128)
    6. onboard device to the cloud https://github.com/plgd-dev/plgd.mobile/blob/master/ocfclient/OCFClient.go#L168 - (move to provision mode, set cloud resource, move to normal mode)

    that's all I think

    Yorick Coleu
    @YorickColeu

    Hello @ondrejtomcik , thanks for your response. Actually I had an InAppWebView error that I caught by implementing a onConsoleMessage callback like this:

    diff --git a/lib/components/oauthHandler.dart b/lib/components/oauthHandler.dart
    index 1093d76..bb2596e 100644
    --- a/lib/components/oauthHandler.dart
    +++ b/lib/components/oauthHandler.dart
    @@ -4,6 +4,7 @@ import 'package:flutter/gestures.dart';
     import 'package:flutter/material.dart';
     import 'package:flutter_spinkit/flutter_spinkit.dart';
     import 'package:flutter_inappwebview/flutter_inappwebview.dart';
    +import 'package:flutter/foundation.dart';
    
     class OAuthHandler extends StatefulWidget {
       final String authUrl;
    @@ -67,6 +68,10 @@ class _OAuthHandlerState extends State<OAuthHandler> {
                       });
    
                     },
    +                onConsoleMessage: (InAppWebViewController controller, ConsoleMessage consoleMessage) {
    +                  debugPrint('consoleMessage: $consoleMessage');
    +                  return;
    +                },
                     onLoadError: (InAppWebViewController controller, String url, int code, String message) {
                       if (code == 102) { // apple signin returns 102 what is not an error
                         return;

    I caught the following error: "window.flutter_inappwebview.callHandler is not a function". I fixed this with a workaround found at: pichillilorenzo/flutter_inappwebview#218.

    According to the flutter_inappwebview release note (https://pub.flutter-io.cn/packages/flutter_inappwebview/changelog), this should have been fixed in flutter_inappwebview v5.0.0.

    I tried to upgrade to flutter_inappwebview v5.0.0 but it breaks a lot of things.

    Ondrej Tomcik
    @ondrejtomcik
    @YorickColeu thank you for your feedback and investigation!!! I am unfortunatelly fully booked. Would you be willing to update plgd.mobile to the newest flutter_inappwebview and contribute it to our repo? :)
    David Márquez Fàbrega
    @DavidMarquezF
    Is it normal that I'm getting get requests every second on my device if it's connected to the cloud ( and I haven't enabled notifications)? Or I'm doing something wrong? (I'm using try.plgd.cloud) Thanks in advance!
    Ondrej Tomcik
    @ondrejtomcik
    To which resource @DavidMarquezF ?
    David Márquez Fàbrega
    @DavidMarquezF
    All the resources I have (binary switch, sensor measurement and temperature
    David Márquez Fàbrega
    @DavidMarquezF
    Well actually a custom resource I have with a oic.if.r interface doesn't, but all the others mentioned above do
    Ondrej Tomcik
    @ondrejtomcik
    @DavidMarquezF such a feature doesn't exist and we are also not aware of such a behavior. And no, it's not normal to receive GET request every second on your device. Do you have in your setup only plgd cloud bundle and your device? Nothing else?
    Jozef Kralik
    @jkralik
    @DavidMarquezF Could you send us data/logs/coap-gateway.log, /data/logs/coap-gateway-unsecure.log from docker container ?
    David Márquez Fàbrega
    @DavidMarquezF
    I wasn't running docker, I was using the try.plgd.cloud/ one. I will try to set it up with docker and give you an update if I find anything. Thanks!
    Ondrej Tomcik
    @ondrejtomcik
    @DavidMarquezF no need to reproduce is locally. Just connect your device to try.plgd.cloud and write us, we will check our logs in monitoring system.
    David Márquez Fàbrega
    @DavidMarquezF
    Okay i connected now (
    Jozef Kralik
    @jkralik
    @DavidMarquezF And what is your deviceID ? This can helps us to filter logs...