Skip to content
This repository has been archived by the owner on Jun 6, 2023. It is now read-only.

the Topic header of the request was not specified and was required #91

Open
ghost opened this issue Aug 28, 2017 · 5 comments
Open

the Topic header of the request was not specified and was required #91

ghost opened this issue Aug 28, 2017 · 5 comments

Comments

@ghost
Copy link

ghost commented Aug 28, 2017

my code works with the development certificate. But when I try and use the production certificate it gives me 'the Topic header of the request was not specified and was required' I did change host from push.Development to push.Production but it doesn't work. I also made sure that my .p12 file is made using both the cert and key.

@yuanlida
Copy link

yuanlida commented Nov 8, 2017

I met the same problem.

@kmcrawford
Copy link
Contributor

kmcrawford commented Nov 15, 2017

I was able to fix by using the app id set as a header:

headers := push.Headers{Topic: appId} //"com.myapp.app"
id, err := service.Push(token, &headers, b)

@froodian
Copy link

you can also generally use certificate.TopicFromCert to get this bundle id if you don't have it on hand.

@yuanlida
Copy link

Thanks,I add these codes in file service.go:
req.Header.Set("Content-Type", "application/json")
req.Header.Set("apns-topic", ".......")
headers.set(req.Header)

@nathany
Copy link
Contributor

nathany commented Nov 17, 2017

It would be a good idea to document TopicFromCert in the README.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants