Sign up for our live Camera Kit office hour on July 17 @ 9:30am (PT) / 4:30pm (GMT)

Login Kit for Push2Web Unclear instructions

Refract_Studio
Refract_Studio Posts: 18 🔥

Hey Ya'll sorry I am little slow today.

in order to use push2Web Do I need to set up this entire flow to get the correct auth token? It's not entirely clear from the camera kit docs.

https://docs.snap.com/snap-kit/login-kit/Tutorials/web#client-side-only-web-application-integration

or can I just use the oAuth token from the dev portal?

Thanks for your help!

Once I get this implemented I think I will have a good React+CameraKit starter template.

Comments

  • Refract_Studio
    Refract_Studio Posts: 18 🔥
    edited February 23 #2

    using staging keys and the staging OAuth clientID's are returning a 401 for me :disappointed:

    Not sure what I'm missing

    repo for the curious: https://github.com/s-r-jones/camera-kit-web-test

  • JacekC
    JacekC Posts: 25 👻

    Hi,
    Just to confirm you are not missing anything else, can you please check if by using our Sample Page https://camera-kit.snapchat.com/websdk/sample/push2web you will get the lens from the Lens Studio? If this works, we can then dive deeper into your implementation.

  • JacekC
    JacekC Posts: 25 👻

    Also, the link https://github.com/s-r-jones/camera-kit-web-test doesn't work me. If your repo public?

  • Refract_Studio
    Refract_Studio Posts: 18 🔥

    @JacekC Your example works. It must be user error :). I'll let you know if I can't get it working. Thanks for looking!

  • Refract_Studio
    Refract_Studio Posts: 18 🔥

    okay @JacekC I can confirm I am getting a good token, and doing the web flow from the docs, but I am getting a 403 when attempting this call: push2Web.subscribe(token, session, cameraKit.lensRepository);
    https://api-kit.snapchat.com/com.snap.camerakit.v3.PushToDevice/ListenLensPush

    The above repo is now public. Line 120 in App.tsx is where most of the action is. Thanks for looking!

  • @JacekC your API key is exposed in your github FYI.
    I'm finding the documentation a bit lacking as well, the push-2-web docs say "the Client-Side Only Web Application Integration method can be used" and "Subscribing to incoming events requires the use of a Login Kit access token", but don't say how to get that token.
    snap.loginkit.fetchUserInfo() doesn't provide it. I did find snap.loginkit.getSharedDataAccessToken() in the source code, so after fetchUserInfo() I'm trying:
    push2Web.subscribe(
    snap.loginkit.getSharedDataAccessToken(),
    session,
    cameraKit.lensRepository
    )
    but I'm getting this error in my console: POST https://api-kit.snapchat.com/com.snap.camerakit.v3.PushToDevice/ListenLensPush 403 (Forbidden)