web-push-libs / web-push-php

Web Push library for PHP
MIT License
1.72k stars 300 forks source link

MS Edge Browser WebPush Support #136

Closed ozgurhangisi closed 6 years ago

ozgurhangisi commented 6 years ago

NOTE: Please test in a least two browsers (i.e. Chrome and Firefox). This helps with diagnosing problems quicker.

Please confirm the following:

Setup

Please provide the following details, the more info you can provide the better.

Please check that you have installed and enabled these PHP extensions :

Please select any browsers that you are experiencing problems with:

Please specify the versions (i.e. Chrome Beta, Firefox Beta etc). MS Edge 17

Problem

Microsoft Edge will support Webpush Notification soon. They already started to support Webpush in Insider (Beta) program and probably it will be live soon. It only supports sending with VAPID. So I get endpoint, publickey, token correctly but I couldn't send webpush yet.

My problem is when I send webpush it gives 401 Invalid Token error. But expired parameter is false in result. So expired parameter only works when status code in 404 and 410.

Is it possible to add 401 to expired status code ?

Detailed description is here : https://blogs.windows.com/msedgedev/2017/12/19/service-workers-going-beyond-page/#bru6dYJBWR3CBEyB.97

Please explain what behaviour you are seeing.

It returns http 401 Invalid Token but expired parameter is not true in result

Expected

Expired parameter should be true when status code is 401

Please explain what you expected to happen Expired parameter should be true when status code is 401

Features Used

Example / Reproduce Case

Result is :

[success] =>   | [endpoint] => https://db5.notify.windows.com/w/?token=XXXXXX   | [message] => Client error: POST https://db5.notify.windows.com/w/?token=XXXXXX resulted in a 401 Unauthorized response   | [statusCode] => 401   | [expired] =>   | [content] => GuzzleHttp\Psr7\Stream Object   | (   | [stream:GuzzleHttp\Psr7\Stream:private] => Resource id #6   | [size:GuzzleHttp\Psr7\Stream:private] => 0   | [seekable:GuzzleHttp\Psr7\Stream:private] => 1   | [readable:GuzzleHttp\Psr7\Stream:private] => 1   | [writable:GuzzleHttp\Psr7\Stream:private] => 1   | [uri:GuzzleHttp\Psr7\Stream:private] => php://temp   | [customMetadata:GuzzleHttp\Psr7\Stream:private] => Array   | (   | )   |     | )   |     | [headers] => Array   | (   | [Content-Length] => Array   | (   | [0] => 0   | )   |     | [X-WNS-MSG-ID] => Array   | (   | [0] => 690BE40828827493   | )   |     | [X-WNS-DEBUG-TRACE] => Array   | (   | [0] => DB5SCH101121621   | )   |     | [Strict-Transport-Security] => Array   | (   | [0] => max-age=31536000; includeSubDomains   | )   |     | [WWW-Authenticate] => Array   | (   | [0] => bearer error="invalid_request",error_description="Invalid token"   | )   |     | [Date] => Array   | (   | [0] => Fri, 22 Dec 2017 14:15:50 GMT   | )   |     | )  

Please provide a code sample that reproduces the issue. If there is a repository that reproduces the issue please put the link here.

Other

Please put any remaining notes here.

Thanks :)

Minishlink commented 6 years ago

This should be fixed in v4.0.0. :)