laravel-notification-channels/facebook

appsecret_proof requrired

Closed this issue · 3 comments

If I send a message via this package, I get the error from facebook that for the graph-api an appsecret_proof is required:

NotificationChannels/Facebook/Exceptions/CouldNotSendNotification with message 'Facebook resonded with an error 100 - GraphMethodException API calls from the server require an appsecret_proof argument'

If I attach it manually in the api method, the message is getting send. Is there a problem with my implementation or is this something new?

I am happy to PR my changes if there is any demand for this.

That error is because your FB App has enabled "Require App Secret" option under Advanced settings. You can disable and you'll be good to go.

We can automatically attach the appsecret_proof but that would require the package users to provide us with their app secret for it to generate the sha256 hash as stated in the official docs. That's something I can consider if its really that important but otherwise it seems like nothing mandatory but good to have for security purposes.

I think it should be optional.

Give the ability to provide the app secret in the config. If the secret is set, generate the appsecret_proof and attach it. If not, simply don't send it.

Would you accept a PR for this?

Sure, please open a PR. And that makes sense.