Conflict in token(ionic services )


In my project,ionic service public key and my (token base api) token conflict ,
how will i use my token and ionic public key in single http request header.


What do you mean, ‘conflict’ ? You mean the HTTP header name is the same for both, or something like that?

That shouldn’t matter as long as Ionic and you API server are on different hosts (servers).
You’d never send the 2 tokens/keys in the same HTTP request.


i got error like this "The api key and app id you provided did not register on the server."
when i include my token in http request for my server


Weird, because you’d say the 2 tokens (for your API and for Ionic) are for different destination hosts, so are never in the same HTTP request.

Did you google for (or search the Ionic forum for) “The api key and app id you provided did not register on the server” ?


Sorry for inconvenient ,request header authorization problem ,
ionic service gave one token
my api server gave on token
what will i do for request header authorization
I do it like this,

In .config

.factory(‘TokenInterceptor’, function($q, $window) {
return {
request: function(config) {
config.headers = config.headers || {};
if (window.localStorage.accessToken) {
config.headers.Authorization = 'Bearer ’ + window.localStorage.accessToken;
return config;
response: function(response) {
return response || $q.when(response);


So if I understand correctly, this interceptor would add your token to EVERY http request.

Maybe that’s the problem.

Why would your API token need to be added to http requests that are sent to Ionic’s analytics server?
I think it should only be added to http requests that are sent to your OWN server.


thats correct , how will i implement ,plz help


I’m not sure, maybe in the interceptor you can add a check for the host name or URL.
And then add the token to the HTTP header only if it’s the URL of your server, and otherwise you don’t add it.