Code Monkey home page Code Monkey logo

Comments (7)

Ja0ck5 avatar Ja0ck5 commented on August 16, 2024 2

Sorry about that.

from apns-http2.

judepereira avatar judepereira commented on August 16, 2024

This is most likely because you haven't put in the ALPN JAR in your boot classpath. Please see #28.

from apns-http2.

leoliangyixun avatar leoliangyixun commented on August 16, 2024

I have the same issue , when I using provider authentication tokens, here is my code:
@test
public void testAPNsHttp2Sync() throws UnrecoverableKeyException, KeyManagementException, CertificateException,
NoSuchAlgorithmException, KeyStoreException, IOException {
// Using provider authentication tokens
final ApnsClient client = new ApnsClientBuilder()
.inSynchronousMode()
.withProductionGateway()
.withApnsAuthKey("-----BEGIN PRIVATE KEY-----MIGTAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBHkwdwIBAQQgjZTdQgZM/8AQspuD9G7aTsQTEBqomiu4TJ0LxU5gaI+gCgYIKoZIzj0DAQehRANCAASbKaMLxR56q2N0oQ8YXcOFEhHL7cAuNcLUwkMTLplUKoaRzSY9Me85UnjtuMxjmYpFkbmYtFtrNULzedlBXk/K-----END PRIVATE KEY-----")
.withTeamID("4S5ZWGJSPN")
.withKeyID("CPPMHRM7CC")
//.withDefaultTopic("<your app's topic>")
.build();

    // Build your notification
    Notification n = new Notification.Builder("4f872918800d5010c332ad3e0e68cc040d2979d3db7fedc20f0e98bc70235556").alertBody("Hello").build();
    // Send the notification

    // Synchronous
    NotificationResponse result = client.push(n);
    System.out.println(result);
}

and this is the error:

java.lang.IllegalArgumentException: Illegal base64 character 2d

at java.util.Base64$Decoder.decode0(Base64.java:714)
at java.util.Base64$Decoder.decode(Base64.java:526)
at com.clevertap.apns.internal.JWT.ES256(JWT.java:82)
at com.clevertap.apns.internal.JWT.getToken(JWT.java:64)
at com.clevertap.apns.clients.SyncOkHttpApnsClient.buildRequest(SyncOkHttpApnsClient.java:252)
at com.clevertap.apns.clients.SyncOkHttpApnsClient.push(SyncOkHttpApnsClient.java:267)
at com.kerwinyang.training.apns.core.APNsHttp2Test.testAPNsHttp2Sync(APNsHttp2Test.java:44)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75)
at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86)
at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:252)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:94)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:191)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)

from apns-http2.

judepereira avatar judepereira commented on August 16, 2024

from apns-http2.

leoliangyixun avatar leoliangyixun commented on August 16, 2024

by the way, should I put in the ALPN JAR in my boot classpath when using provider authentication tokens

from apns-http2.

judepereira avatar judepereira commented on August 16, 2024

from apns-http2.

judepereira avatar judepereira commented on August 16, 2024

Closing due to inactivity.

from apns-http2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.