0

I'm trying to send a PUSH via Urban Airship using code in my app.

I can't seem to find any solid documentation on how to do this. I've tried approaches from other posts here on StackOverflow, this one being the most promising: how to send push from iphone via urban airship?

However, following the approach in that post I am getting a 401 error (401 Unauthorized – The authorization credentials are incorrect)

For the auth, I am using the App Key and App Secret. I read on a c# board, that using the App Master Secret as the password will work as expected.

When I tried that approach, I received a 400 error: 400 Bad Request – The request body was invalid, either due to malformed JSON or a data validation error. See the response body for more detail.

Community
  • 1
  • 1
Buyin Brian
  • 2,781
  • 2
  • 28
  • 48

1 Answers1

1

The link uses the old push api. Check out docs on the Push API v3.

However we don't recommend storing or using the master secret directly in the app for security reasons. Instead you should have your app authenticate with a server, then have the server send the push for the device.

ralepinski
  • 1,756
  • 8
  • 15
  • That post actually uses the latest (version 3) if you scroll to the bottom. That is what I am working with at the current time. – Buyin Brian May 16 '16 at 17:23
  • The response body will tell you where the error is. Without posting the request body I am unable to help. – ralepinski May 16 '16 at 21:31
  • The error is 401 (as mentioned in my original post). Here is the request body: status code: 401, headers { Connection = close; "Content-Length" = 54; "Content-Type" = "application/vnd.urbanairship+json;version=3"; Date = "Tue, 17 May 2016 17:06:45 GMT"; "Www-Authenticate" = "Basic realm=\"API\""; – Buyin Brian May 17 '16 at 17:08