Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ionic: Uncaught Error: API request /v1/profile missing parameter identity_id #40

Closed
Gp2mv3 opened this issue Feb 11, 2016 · 5 comments
Closed

Comments

@Gp2mv3
Copy link

Gp2mv3 commented Feb 11, 2016

Hi,
I'm trying to use Branch for my Ionic app but it's impossible... I receive this error when trying to set the identity or generating a link (this one is from setIdentity):
Uncaught Error: API request /v1/profile missing parameter identity_id

The init is done correctly as I don't receive any error. But what is strange here is that the result of the init function is an empty structure:
{"data":null,"data_parsed":null,"has_app":null,"identity":null,"referring_identity":null,"referring_link":null}

The init is done in $ionicPlatform.ready and the createUrl is done via a user action (so after init).

What am I doing wrong ?

Thanks !

@aaustin
Copy link
Contributor

aaustin commented Feb 13, 2016

Hi @Gp2mv3 - That's quite strange.

  1. Can you enable debug (branch.setDebug(true);) and share the logs?
  2. Can you also share how you're initing the library? Here's a Cordova example: https://github.com/BranchMetrics/Cordova-Ionic-PhoneGap-Deferred-Deep-Linking-SDK/blob/master/cordova-testbed/www/js/index.js#L38

Lastly, how did you add the module? NPM or from the Github repo?

@Gp2mv3
Copy link
Author

Gp2mv3 commented Feb 13, 2016

Hi, thanks for this fast answer.
branch.setDebug(true); doesn't do anything (it seems). Where are the logs normally (Logcat or Browser logs) ?

The init is done like this:

 $ionicPlatform.ready(function() {
    if (window.cordova) {
      branch.setDebug(true);
      branch.init(Config.branchKey, function(err, data) {
        console.log("branch ready");
        console.log(err);
        console.log("data "+JSON.stringify(data));
      });

      $ionicPlatform.on('resume', function(err, data) {
        branch.init(Config.branchKey, function(err, data){
          console.log("branch resume");
        });
      });
    }
  });

Where Config.branchKey is the test key. Then the url generation is done via

      branch.link({
        channel: 'shareMenu',
        feature: 'group',
        stage: 'share group',

        data: {
          "$deeplink_path": "app/group/"+$scope.group._id
        }
      }, function(err, link){
        if(err) {
          alert(err);
        }
        else {
          window.plugins.socialsharing.share($scope.group.name, null, null, link);
        }
      });

I installed the plugin via ionic plugin add https://github.com/BranchMetrics/Cordova-Ionic-PhoneGap-Deferred-Deep-Linking-SDK.git.

Thanks !

@aaustin
Copy link
Contributor

aaustin commented Feb 13, 2016

Hmm.. that's right. I think debug mode was never implemented in this version. We're about to roll out an entirely new version of the Cordova SDK with all of this implemented properly.

@Gp2mv3 And is this with the Test version of Nightspot? I see a few successful opens, and a link that was created in the live view. https://dashboard.branch.io/#/liveview/events/view This would indicate it's working some of the time...

  • Can you try changing the init method to:
    branch.init(Config.branchKey, { }, function(err, data) {

@Gp2mv3
Copy link
Author

Gp2mv3 commented Feb 17, 2016

Yes it's for NightSpot but I'm still getting this error and I
Even with branch.init(Config.branchKey, { }, function(err, data) {...

What's weird is that I see in the Dashboard that I opened the app multiple times and that Identities are stored as well. I recognize my phone in the events. So maybe the error is a false alarm ?

EDIT: By removing the CSP, the error disapeared but it's not really a good solution...
Here is the CSP I'm using:
<meta http-equiv="Content-Security-Policy" content="default-src 'self' 'unsafe-inline' https: wss: data: gap: https://ssl.gstatic.com; style-src 'self' 'unsafe-inline'; media-src *">

@Gp2mv3
Copy link
Author

Gp2mv3 commented Feb 17, 2016

Of, by enabling eval, it's working so it's the exact same issue as issue #30.

@Gp2mv3 Gp2mv3 closed this as completed Feb 17, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants