# Is my ionic app safe?

**URL:** <https://forum.ionicframework.com/t/is-my-ionic-app-safe/187012>\
**Category:** Appflow\
**Created:** [April 10, 2020, 1:57pm UTC](https://forum.ionicframework.com/t/is-my-ionic-app-safe/187012 "2020-04-10T13:57:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![itosoft](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/itosoft/32/131389_2.png) [@itosoft](https://forum.ionicframework.com/u/itosoft)\
**Post date:** [April 10, 2020, 1:57pm UTC](https://forum.ionicframework.com/t/is-my-ionic-app-safe/187012/1 "2020-04-10T13:57:26Z")

</div>

hi it is always my question and worries about  
is ionic application secured? is that possible to crack the ionic app and get the inside code or sth like this for example if my code is like this(add a service to my app)

```auto
    import { Injectable } from '@angular/core';
    import { HttpClient } from '@angular/common/http';
    import { Observable } from 'rxjs';
    import { map } from 'rxjs/operators';
     
    @Injectable({
      providedIn: 'root'
    })
    export class EncryptionService {
    
      url = 'https://api.amnas....com';
       api-key='......'

      constructor(private http: HttpClient) { }
     
        newcheck(checkid: string ,cost: string,toname: string,tocode: string,passcode: string,date: string,checkfor: string,back: string): {
        return this.http.get(`${this.url}?key=${this.api-key}&checkid=${encodeURI(checkid)}&cost=${encodeURI(cost)}&toname=${encodeURI(toname)}&tocode=${encodeURI(tocode)}&passcode=${encodeURI(passcode)}&date=${encodeURI(date)}&checkfor=${encodeURI(checkfor)}&back=${encodeURI(back)}`);
    }
    
   
    }

```

is that possible for anyone to crack my export app(apk) and extract api-key?

---

<div class="post-metadata">

**Author:** ![MesbahM](https://avatars.discourse-cdn.com/v4/letter/m/3ec8ea/32.png) [@MesbahM](https://forum.ionicframework.com/u/MesbahM)\
**Post date:** [December 21, 2020, 9:31pm UTC](https://forum.ionicframework.com/t/is-my-ionic-app-safe/187012/2 "2020-12-21T21:31:41Z")

</div>

I know it’s been several months, but in case you were still wondering, yes it is possible to decompile an APK and extract api keys and other strings. Any client environment should be considered insecure (aka hackable).

Typical solutions are to proxy the request through a backend that inserts the api key/secret or use vendor-provided tools to lock down or rate-limit the key (ex: Google Maps provides an option to restrict the key when a specific Referer header is not present). Of course, if your app is fully public (no login/auth mechanism), then a proxy could still be exploited.

---

<div class="post-metadata">

**Author:** ![rapropos](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/rapropos/32/100227_2.png) [@rapropos](https://forum.ionicframework.com/u/rapropos)\
**Post date:** [December 21, 2020, 9:52pm UTC](https://forum.ionicframework.com/t/is-my-ionic-app-safe/187012/3 "2020-12-21T21:52:26Z")

</div>

@MesbahM has completely nailed the actual question here, so I’d just like to mention that [`HttpParams`](https://angular.io/api/common/http/HttpParams) presents a much more readable alternative to the method OP is using to create that monstrosity of a URL.
