{"action":"opened","issue":{"url":"https://api.github.com/repos/SAPDocuments/Tutorials/issues/2404","repository_url":"https://api.github.com/repos/SAPDocuments/Tutorials","labels_url":"https://api.github.com/repos/SAPDocuments/Tutorials/issues/2404/labels{/name}","comments_url":"https://api.github.com/repos/SAPDocuments/Tutorials/issues/2404/comments","events_url":"https://api.github.com/repos/SAPDocuments/Tutorials/issues/2404/events","html_url":"https://github.com/SAPDocuments/Tutorials/issues/2404","id":331595977,"node_id":"MDU6SXNzdWUzMzE1OTU5Nzc=","number":2404,"title":"How to send REST notifications with OAuth?","user":{"login":"kedeggel","id":17932749,"node_id":"MDQ6VXNlcjE3OTMyNzQ5","avatar_url":"https://avatars3.githubusercontent.com/u/17932749?v=4","gravatar_id":"","url":"https://api.github.com/users/kedeggel","html_url":"https://github.com/kedeggel","followers_url":"https://api.github.com/users/kedeggel/followers","following_url":"https://api.github.com/users/kedeggel/following{/other_user}","gists_url":"https://api.github.com/users/kedeggel/gists{/gist_id}","starred_url":"https://api.github.com/users/kedeggel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kedeggel/subscriptions","organizations_url":"https://api.github.com/users/kedeggel/orgs","repos_url":"https://api.github.com/users/kedeggel/repos","events_url":"https://api.github.com/users/kedeggel/events{/privacy}","received_events_url":"https://api.github.com/users/kedeggel/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-06-12T13:48:45Z","updated_at":"2018-06-12T13:48:45Z","closed_at":null,"author_association":"NONE","body":"I've found that it is also possible to send push notifications with REST, and I have to authenticate with basic auth. But in my app I use OAuth and I'd like to send push notification from my iOS device to others. Is it possible to use OAuth to authenticate? I've tried the following approach:\r\n\r\n```\r\nlet urlRequest = try! URLRequest(url: \"https://hcpms-pXXXtrial.hanatrial.ondemand.com/restnotification/application/APPID\", method: .post)\r\n        let body: [String : Any] = [\r\n            \"alert\": \"This is a Push Message\",\r\n            \"badge\": 1\r\n            ]\r\n\r\n        let data = try! JSONSerialization.data(withJSONObject: body, options: [])\r\n\r\n        let uploadTask = onboardingContext.sapURLSession.uploadTask(with: urlRequest, from: data) { (data, urlResponse, error) in\r\n            // DO SOMETHING\r\n        }\r\n\r\n        uploadTask.resume()\r\n```\r\n\r\nI get the following error: `OAuth2Error.tokenRejected: The newly acquired or refreshed token got rejected`.\r\n"}}
{"actor":{"display_login":"kedeggel"}}