Sending data to an ionic app (URL GET Parameters or Cookies)

I would like to be able to pass in an authenticated sessionId to an Ionic app from another site, both are in the same domain being served off the same server.

I’ve found out how to call a specific page in an Ionic app using the latest deep linking functionality described by Josh Morony.

The call would look like: http://localhost:8100/#/landing_page

Defined in Ionic by:
@IonicPage({
segment: ‘landing_page’
})

This allows me to call into my new Ionic app at a specific point. Now I need to pass it some session data. The same article sort of discusses it by defining it as:

@IonicPage({
segment: ‘landing_page/:sessionId’
})

However he just talks about passing in the data from within the app using the normal navCtrl.push() call.

Does anyone know how to get the data from the URL when sent in like:
http://localhost:8100/#/landing_page/sessionId

It would be nice if the sessionId would just be part of the NavParams, but that doesn’t seem to be the case.

I’m also open to using a cookie, but don’t know how to access cookies from within Ionic.

Some background: I’m new to Ionic development and I’m experimenting with expanding an existing site to include a new section written in Ionic. So it would start out as kind of an Ionic desktop app and later we would also use it on native platforms.

Any ideas?

Just a quick update. Apparently just the process of me writing the question helped a bit.

It would appear the yes indeed when passing a parameter as I described, it will get placed in the NavParams. I apparently was just doing something wrong before. So if you pass in a sessionId you can access it from the NavParams like normal:
constructor(public navCtrl: NavController, public navParams: NavParams) {
this.sessionId = navParams.get(‘sessionId’);
console.log(this.sessionId);
}

I’m still not completely happy with this solution as it requires a lot of definition work to set it up and is only useful when calling the page from an external source. I would really love a way to just set a cookie and access it from with the ionic app to see if we have a session available.

If you have any degree of control here, please use JWTs. They were built out of decades of experience with the flaws of session IDs and cookies.