exponea / exponea-ios-sdk

MIT License
19 stars 27 forks source link

Auth header Token vs Basic #14

Closed lunicleonid closed 4 years ago

lunicleonid commented 4 years ago

To be able to use the SDK I had to change the value from here https://github.com/exponea/exponea-ios-sdk/blob/212a4fbe3094f2b6a787b5b4161b23f848b53f5b/ExponeaSDK/ExponeaSDK-Shared/Repository/RequestFactory.swift#L57

to request.addValue("Basic \(token)”,

The "Token" does not work while "Basic" works. Didn't need to do it on Android because I could set the value from the config file https://github.com/exponea/exponea-android-sdk/blob/2.7.1/sdk/src/main/java/com/exponea/sdk/network/NetworkHandlerImpl.kt#L34

wassil commented 4 years ago

Please don't do this. Basic authorization is dangerous to use on the client side, that's why we deprecated it. Your private auth token will be embedded into your application and if it leaks, malicious user could use it to download/wipe your customer data.

It's advised to use Token base auth. With a public token, you cannot perform certain dangerous operations, mostly you can just upload data events. To generate a token for it, go to Exponea web app and navigate to Project settings/Access Management/API. In there you have list of your tokens. You see a dropdown with groups, each of them is either public of private. Private group is used for Basic auth, Public group will give you public token for Token auth. https://docs.exponea.com/reference#access-keys My guess is you used private group for token auth which doesn't work. Try to create new public group and use that token.

All of our customers use Token based auth, it should work without issues. If you still have problems let us know and we'll look into it.

lunicleonid commented 4 years ago

Thank you