How to send bearer token header for all map service requests by default

930
3
08-29-2017 11:12 PM
SrikanthKusam1
New Contributor II

Hi,

I am developing an IOS app, that will have custom OWIN based authentication. I have proxy page which will accept access token, authorize the request and redirect requests to arcgis server .But from IOS sdk i am not sure how to append this access token on the header of all the service requests. Can anyone help on how to implement this?

Thanks,

Srikanth Kusam

0 Kudos
3 Replies
RyanOlson1
Esri Contributor

Hi there,

Please try this:

        // to set headers for every remote resource globally

        AGSRequestConfiguration.global().userHeaders = ["my key" : "my value"]

//

// OR      

// 

        // to set it for just one resource

        let lyr : AGSArcGISTiledLayer! = nil

        lyr.requestConfiguration = AGSRequestConfiguration.global().copy() as? AGSRequestConfiguration

        lyr.requestConfiguration?.userHeaders = ["my key" : "my value"]

0 Kudos
SrikanthKusam1
New Contributor II

Hello Ryan,

Thanks for your reply. I think AGSRequestConfiguration class is available in 100.1. But i am still using 10.2.5. Is there any way to do same in 10.2.5?

Thank you,

Srikanth Kusam

0 Kudos
RyanOlson1
Esri Contributor

With 10.2.5 I cannot think of how this would be achieved.

0 Kudos