WNS - Tiles are delivered and Toasts not - windows-phone-8

I have a big problem with the deliveration of Toast-Messages. The tiles are delivered as expeceted.
The first toast message I send to the device (with a new push URL) gets a resonse header with
X-WNS-NOTIFICATIONSTATUS: received
X-WNS-STATUS: received
but the toast is not delivered to the device.
If I send the toast another time the response from Microsoft looks like
X-WNS-NOTIFICATIONSTATUS: dropped
X-WNS-STATUS: dropped
X-WNS-ERROR-DESCRIPTION: Blocked channel URL
My HTTP-Requsest looks like this:
URL:
https://db5.notify.windows.com/?token=AwYAAAC5SQWdpe....25osxgpm3dB3zTN8io2OPMUIRs%3d
Header:
Content-Length: 102
X-WNS-Type: wns/toast
Authorization: Bearer EgAZAQMAA...
Content-Type: text/xml
Body:
<toast>
<visual>
<binding template="ToastText01">
<text id="1">bodyText</text>
</binding>
</visual>
</toast>
I hope someone can help me with this!
kind regards,
Bruno

Make sure you've set the Toast Capable option in your appx manifest to true first.
Check step 1 of this documentation: Enabling "Toast Notifications" for Windows 8 Store App or Visual Studio instructions here: Enabling "Toast Notifications" for Windows 8 Store App

Related

How to get a web client handling forms to send page ID info to server without client side scripting

I'm writing an application which will run on a microcontroller (arduino or Raspberry Zero) with wifi and a web server which will be configurable by a web browser without any client side scripts. This will use a string of HTML forms for the purpose of creating a number of small files on the microcontroller which will be interpreted by the microcontroller to perform its tasks.
I'm writing it initially on a Slackware Linux system but when it gets close to completion, will move it all to a Raspberry Pi running a customised version of Ubuntu Linux for final tuning.
I'm using lighttpd with mod_fastcgi and libfcgi and I am writing forms handler software in C.
Now, ideally, the responses returned to the server by each form would be processed by its individual handler daemon started by mod_fcgi, however I have not been able to figure out how to configure fastcgi to load more than one handler daemon. My fcgi.conf file is pointed at by a link later in this missive.
I could live with this restriction but another problem arises. In using just one handler, the action="handlerProgram" field at the top of every form has to point at that one handler, each form is unique and must be handled differently so how do I tell the formsHandler program which form is being handled? I need to be able to embed another label into each HTML form somewhere so that the web client will send this back to the server which will pass its value to the forms handler via the environment - or some such mechanism. Any clues on how to do this? Pleaase?
Peter.
PS. Here's a link to the related config and html data. HTML Problem
Maybe one of these solutions may help :
In the html code, add informations about the form to handle after the handler program name in the action tag, like :
action="/cgi-bin/handlerProgram/id/of/form/to/handle"
In your CGI handlerProgram you'll have the PATH_INFO environment variable valued to "/id/of/form/to/handle". Use it to know what form to handle.
In the html code add a hidden input field to your form like :
<input type="hidden" id="form_to_hanlde" value="form_id"/>
Just use the form_to_handle field's value in you handlerProgram to know what form to handle.
Joe Hect Posted an answer which completely solves this question.
The information which needed to be sent for the form called 'index.htm' is the name of the form. I used the action field "ACTION=/formsHandler.fcgi/index.htm" and below is the contents of the environment returned as reported by echo.fcgi (renamed to formsHandler.fcgi to avoid having to change anything else in my config.). If you can decipher the listing after this page has scrambled it, you will see that the required information is now present in a number of places, including PATH_INFO as suggested. Thank you, Joe.
Now all I have to do is figure out how to vote for you properly.
{
Request number 1
CONTENT_LENGTH: 37
DOCUMENT_ROOT: /home/lighttpd/htdocs
GATEWAY_INTERFACE: CGI/1.1
HTTP_ACCEPT: text/html, application/xhtml+xml, */*
HTTP_ACCEPT_ENCODING: gzip, deflate
HTTP_ACCEPT_LANGUAGE: en-AU
HTTP_CACHE_CONTROL: no-cache
HTTP_CONNECTION: Keep-Alive
HTTP_HOST: 192.168.0.16:6666
HTTP_PRAGMA:
HTTP_RANGE:
HTTP_REFERER: http://192.168.0.16:6666/
HTTP_TE:
HTTP_USER_AGENT: Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko
HTTP_X_FORWARDED_FOR:
PATH:
PATH_INFO: /index.htm
PATH_TRANSLATED: /home/lighttpd/htdocs/index.htm
QUERY_STRING:
CONTENT_LENGTH: 37
CONTENT:
REMOTE_ADDR: 192.168.0.19
REMOTE_HOST:
REMOTE_PORT: 54159
REQUEST_METHOD: POST
REQUEST_ACTION:
ACTION:
REQUEST_URI: /formsHandler.fcgi/index.htm
REDIRECT_URI:
SCRIPT_FILENAME: /home/lighttpd/htdocs/formsHandler.fcgi
SCRIPT_NAME: /formsHandler.fcgi
SERVER_ADDR: 192.168.0.16
SERVER_ADMIN:
SERVER_NAME: 192.168.0.16
SERVER_PORT: 6666
SERVER_PROTOCOL: HTTP/1.1
SERVER_SIGNATURE:
SERVER_SOFTWARE: lighttpd/1.4.41
}

ASP.net core auth cookie not being set in Google Chrome when running in dev

I have three applications in my solution, all built in asp.net core 1 MVC 6.
App 1 is an MVC app used for authenticating a user.
App 2 is an Angular SPA app and is the main app in the solution.
App 3 is an MVC web api application.
In app 3, I have the usual asp.net core SignInManager and UserManager code (the same code as you get by default when you start a new MVC 6 template - only different is, it exists in my web api here). And the login/logout/register etc is exposed via web api methods in my AccountController. This allows me to lock down the web api, so only authenticated requests get processed (using the [Authorize] attribute).
When I call the "Login" method in my AccountController, if login is successful - it returns a Set-Cookie directive with the following name: ".AspNet.Microsoft.AspNet.Identity.Application" (this is used for authentication)
The login app then forwards the user from App1 to App2. All subsequent requests to the web api (App3) are then Authenticated and allowed to be executed. NOTE: By subsequent requests - specifically I mean, within App2, angular calling to ask for data from the web service.
All of this works fine - well, it works in IE fine. Which brings my to my question, why would this not be working in Chrome? I see the "Set-Cookie" directive coming back from the response of the web api Login in chrome, but subsequent requests do not have this cookie attached.
What am I doing wrong?
NOTE:
My Http Response from the login method looks like this:
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-Type: application/json; charset=utf-8
Expires: -1
Server: Kestrel
Set-Cookie: .AspNet.Microsoft.AspNet.Identity.Application=CfDJ8FWIuvXs-TxKoIYE8259iAY52B_VZDPTTvYwZ-WAo8hhPCdLhmUfxNZD1wjxEt0sqqnZl6NomwHPNTNFkBxsq4cw_WkQYklnj_dK79wodIguLdPXAbKu6UbS6HKRBxFxjOKVAfIdyxZJ6xA2CtnR9nJC_CSg7v1vFSzgDEiSBso8D3aDNjzFk8
7oIJodC7WLVxWUqdUpjaGRCXqHTYjTwgL9DCihnajAlB921_oEPinUwIPP8g_ugCQmqbFq6kgQ-GwPTifBKRlbtwNsDwbetynl1gIqzELyjgEUAKgtpD9SX7FSjl1grxoGRjbPiXJe-k1SSdnUIHR7wYPkFpiis_c_P1pGkmSyeiDG-lf0xftTlXlnC3BWMbgXeWZn_hsDzbW_Tek3qiq_NB-T0IMGaJgjRnr5DARNcOACWbzwGvHFjsn7n0u7-UZOfzgQJ76d3ra-hjra
-aNcHLgbfDef3TK6z_CKt2iIlnTkyEJXC-3OSGnfWDRvofvQ216UApEPiKoJxiCjWSvGAQCzvf9P1TtKuwAQVxfWz8pL077E-Wfc-4ybtrT6Ivz2VbdFng5Ze5IQ5YWfYYTpDhLSHGKnpFgxVf96f7JwoXlgRq0gs7yEWdWFZs6d18pw-El5sLJr7g; path=/; secure; httponly
Access-Control-Allow-Origin: *
X-SourceFiles: =?UTF-8?B?QzpcVXNlcnNcUm9iZXJ0XERlc2t0b3BcSEJFIE1hbmFnZXJcTUFJTlxCbHVlem9uZSBXZWJBcGlcc3JjXEJ6LkFwcGxpY2F0aW9uXEJ6LkFwcGxpY2F0aW9uLkFwaVx3d3dyb290XGFwaVxhY2NvdW50XExvZ2lu?=
X-Powered-By: ASP.NET
Date: Wed, 04 May 2016 10:39:57 GMT
Content-Length: 16
Hi I had this problem too.
While my localhost environment in VS worked fine and my user could be logged in this didn't worked in the published environment for chrome.
This began when I was trying some self-signed-certificate stuff in IIS on my pre-production-environment by turining on https with configured bindings. And after that I went back to http.
What you could try in Chrome is this: Open the developer-tools goto tab Application and in the left pane choose Clear storage. Under the diagram on the right click Clear site data even if the usage shows 0 Bytes used. Do it anyway.
Finally I got my application with login features back.
Hope that this will help someone, too.
In my case, we had a C# ASP.NET Core 2.1 MVC application which was working fine when I launch in Google Chrome. But one fine day it stopped working.
In Google Chrome Developer Tools I saw below
First, I noticed that Application -> Cookies .AspNetCore.Session was missing.
Second, in Console I noticed below warning.
A cookie associated with a resource at
http://myapplication.company.net/ was set with SameSite=None but
without Secure. It has been blocked, as Chrome now only delivers
cookies marked SameSite=None if they are also marked Secure. You can
review cookies in developer tools under Application>Storage>Cookies
and see more details at
https://www.chromestatus.com/feature/5633521622188032.
I did below to fix it.
In our application, in Startup.cs I had like below
public void ConfigureServices(IServiceCollection services)
{
services.Configure<CookiePolicyOptions>(options =>
{
options.MinimumSameSitePolicy = SameSiteMode.None;
});
}
We changed like below
public void ConfigureServices(IServiceCollection services)
{
services.Configure<CookiePolicyOptions>(options =>
{
options.MinimumSameSitePolicy = SameSiteMode.Strict;
});
}
It solved the issue. I also noticed that in Developer Tools now I can see Application -> Cookies .AspNetCore.Session
I had the same problem, it worked in IE, Edge but not in Chrome, Firefox and Opera.
It seem a cookie size problem, and I solved reducing the data in the cookie.
See this for size limits: chrome cookie size limit

Amazon SNS: JSON toasts to Windows Phones

When I use the Amazon SNS console to send toast messages to a Windows Phone 8 device (i.e. with the MPNS system), I can only send messages in text format. Selecting "Use platform specific JSON message dictionaries" and sending a JSON toast never seems to get to the device. The default message that you see when you select the platform specific format is a tile notification message, and that does work.
For exmple, the following message neither gives an error nor is displayed in the device:
{
"MPNS": "<?xml version=\"1.0\" encoding=\"utf-8\"?><wp:Notification xmlns:wp=\"WPNotification\"><wp:Toast><wp:Text1>Amazon</wp:Text1><wp:Text2>hooray</wp:Text2><wp:Param>this_is/my?extra=parameter</wp:Param></wp:Toast></wp:Notification>"
}
This has been tested with a couple of devices: Lumia 620 with Windows Phone 8.0 and Lumia 1020 with 8.1 beta. I have also tried sending messages from a Java backend, but it just shows up as a raw JSON text toast ({ "MPNS": ...) again. What could possibly be wrong? The JSON is valid, the XML is well-formed... I'm at loss.
I have run into the same issue recently, and found a solution. The SNS documentation for MPNS does not emphasise an important step, but it can be found in the sample code and eventually in the message attributes section of the docs.
You must set two MPNS-specific MessageAttributes on the PublishRequest. Omitting them will cause the delivery to fail with no clues left to investigate: i.e. even if you enable delivery status logs with CloudWatch, providerResponse will be missing.
For reference, the attributes are the following:
Attribute name: AWS.SNS.MOBILE.MPNS.Type
Possible values: token (for tile notifications), toast or raw
Attribute name: AWS.SNS.MOBILE.MPNS.NotificationClass
Possible values: realtime*, priority, regular
(realtime worked for me)
That said, it seems that it is not possible to send custom content to MPNS using the SNS console. But using the API works, so here is an excerpt from the Java sample for using the Java SDK:
AmazonSNS snsClient = ... /* initialise the client */;
Map<String, MessageAttributeValue> notificationAttributes = new HashMap<String, MessageAttributeValue>();
notificationAttributes.put("AWS.SNS.MOBILE.MPNS.Type",
new MessageAttributeValue()
.withDataType("String")
.withStringValue("token")); // or "toast" or "raw", depending on the payload
notificationAttributes.put("AWS.SNS.MOBILE.MPNS.NotificationClass",
new MessageAttributeValue()
.withDataType("String")
.withStringValue("realtime"));
PublishRequest request = new PublishRequest();
request.setMessageAttributes(notificationAttributes);
request.setMessageStructure("json");
request.setTargetArn(... /* topic or endpoint ARN */);
request.setMessage(... /* JSON payload */)
snsClient.publish(request);

Display data in Toast Notification on Windows Phone 8.1

I am generating XML payload for my Windows Phone 8.1 app using PHP,like this:
<toast launch=''>
<visual lang='en-US'>
<binding template='ToastText02'>
<text id='1'>".Input::get('your_msg')."</text>
</binding>
</visual>
</toast>
But my message is not getting displayed when toast notification pops up,notification just reads:
"<App name>: New notification"
Also,it is to be noted that I haven't used any toastTemplate code in my app.Any idea what's going wrong here?
I totally discarded this way and went with raw toast notifications.I had to do a little more work but now it works,how I want it to work exactly.

Google OAuth accept button enabled but doesn't respond using Adobe AIR's built in browser. TypeError with window.sessionStorage occurs on load

I am using Adobe AIR 3.8 and manually generating all of the OAuth calls for my application. Tracing out the user agent of the HTMLLoader that I am using for the OAuth calls in AS3, I get the follow:
Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en) AppleWebKit/533.19.4 (KHTML, like Gecko) AdobeAIR/3.8
I am able to get passed the user login portion and up to the part where they need to accept the permissions to move on. However, AS3 traces out the following error upon load complete of this page:
TypeError: Result of expression 'window.sessionStorage' [undefined] is not an object.
at https://apis.google.com/_/scs/abc-static/_/js/k=gapi.gapi.en.bI438WBuHt0.O/m=googleapis_client,plusone/exm=appcirclepicker/rt=j/sv=1/d=1/ed=1/am=IA/rs=AItRSTNuPHIoFBjGmVBeSqIsgUIKEsrbzA/cb=gapi.loaded_1 : 13
at https://apis.google.com/_/scs/abc-static/_/js/k=gapi.gapi.en.bI438WBuHt0.O/m=googleapis_client,plusone/exm=appcirclepicker/rt=j/sv=1/d=1/ed=1/am=IA/rs=AItRSTNuPHIoFBjGmVBeSqIsgUIKEsrbzA/cb=gapi.loaded_1 : 23
at https://ssl.gstatic.com/gb/js/smm_5a5968e7804546d31a076ff436e35b36.js : 149
at https://ssl.gstatic.com/gb/js/smm_5a5968e7804546d31a076ff436e35b36.js : 152
at https://ssl.gstatic.com/gb/js/smm_5a5968e7804546d31a076ff436e35b36.js : 149
at https://ssl.gstatic.com/gb/js/smm_5a5968e7804546d31a076ff436e35b36.js : 151
at https://ssl.gstatic.com/gb/js/smm_5a5968e7804546d31a076ff436e35b36.js : 151
at https://ssl.gstatic.com/gb/js/smm_5a5968e7804546d31a076ff436e35b36.js : 151
at https://ssl.gstatic.com/gb/js/smm_5a5968e7804546d31a076ff436e35b36.js : 151
This problem is similar to this problem which I assume has been resolved, since this original problem had the accept button disabled: TypeError upon authenticating user using Google OAuth 2
My issue has the start button enabled, but when you click on it, it just grays out and the HTMLLoader (internal AIR browser) goes nowhere. I notice that the option to select which of the user's circles are allowed to see the app activity doesn't render correctly as well. Here is a screenshot of what I see:
Authenticating via a normal browser using the generated OAuth URL works fine.
Also would like to note that the cancel button works just fine in AIR. When the hit cancel, the HTMLLoader redirects to the redirect url with "?error=access_denied" like it should.
Are you using the G+ Sign-In javascript library?