Skip to content

Microsoft Edge Always Returns 401 Not Authorised Invalid Token #233

Closed
@andystables

Description

@andystables

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

Please confirm the following:

  • [ x] I have read the README entirely
  • [x ] I have verified in the issues that my problem hasn't already been resolved

Setup

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

  • Operating System: Windows
  • PHP Version: 7.3
  • web-push-php Version: 5.2

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

  • [x ] gmp
  • [x ] mbstring
  • [x ] curl
  • [x ] openssl

Please select any browsers that you are experiencing problems with:

  • Chrome
  • Firefox
  • Firefox for Mobile
  • Opera for Android
  • Samsung Internet Browser
  • [x ] Other

Please specify the versions (i.e. Chrome Beta, Firefox Beta etc).
Microsoft Edge 44.17763.1.0

Problem

Please explain what behaviour you are seeing.

When pushing to subscription endpoint in Edge, a 401 error is always returned with the WWW-Authenticate header containing 'bearer error="invalid_request",error_description="Invalid token".

I think this may be because Microsoft Push Notification Service requires a (Bearer) Access Token to be passed in the Authorisation header as explained in https://docs.microsoft.com/en-us/previous-versions/windows/apps/hh868206(v%3dwin.10).

Does this library have a facility to pass the bearer token to Microsoft Endpoints? If so, please could the README be updated to provide example of how to make a push to Microsoft Push Service.

If not is it possible to extend the library to allow custom HTTP headers to be inserted into the post to the notification endpoints?

Expected

Please explain what you expected to happen

Push notification to be sent to device.

Features Used

  • [x ] VAPID Support
  • [x ] GCM API Key
  • [x ] Sending with Payload

Example / Reproduce Case

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions