Tips for ensuring successful testing of OAuth flow using the Login Kit feature on the Snapchat API

My current focus is on learning about the Snapchat API and I've started by delving into their Login Kit feature through a web tutorial. However, I've hit a roadblock. Whenever I try to proceed past the Snapchat login site, all I see is a message saying "Something Went Wrong." My implementation is based on the Laravel framework. Despite my application not being reviewed yet, I prefer grasping the workflow before submission. Below is a snippet of my code:

$state = Crypt::encryptString(Str::random(10));

        $url = 'https://accounts.snapchat.com/accounts/oauth2/auth?'.http_build_query([
            'client_id' => '<insert my staging Public / Confidential OAuth Client ID>',
            'redirect_uri' => 'https://example.com/snapchat/callback',
            'response_type' => 'code',
            'scope' => 'https://auth.snapchat.com/oauth2/api/user.display_name https://auth.snapchat.com/oauth2/api/user.bitmoji.avatar https://auth.snapchat.com/oauth2/api/user.external_id',
            'state' => $state
        ]);

I tried testing the constructed login URL with both the staging Public and Confidential OAuth Client IDs, but no success. Clicking the link leads me to this page:

https://i.sstatic.net/ebq72.png

In addition, I created an OAuth flow using JavaScript like so:

<body>
     <div id="display_name"></div>
    <img id="bitmoji" />
    <div id="external_id"></div>
    <hr />
    <div id="my-login-button-target"></div>
</body>

<script>
      window.snapKitInit = function () {
        var loginButtonIconId = "my-login-button-target";
        
        // Mount Login Button
        snap.loginkit.mountButton(loginButtonIconId, {
          clientId: "<insert my staging Public / Confidential OAuth Client ID>",
          redirectURI: "https://example.com/snapchat/callback",
          scopeList: [
            "user.display_name",
            "user.bitmoji.avatar",
            "user.external_id",
          ],
          
          handleResponseCallback: function () {
            snap.loginkit.fetchUserInfo().then(
              function (result) {
                console.log("User info:", result.data.me);
                document.getElementById("display_name").innerHTML =
                  result.data.me.displayName;
                document.getElementById("bitmoji").src =
                  result.data.me.bitmoji.avatar;
                document.getElementById("external_id").src =
                  result.data.me.externalId;
              },
              
              function (err) {
                console.log(err); // Error
              }
            );
          },
        });
      };
      
      // Load the SDK asynchronously
      (function (d, s, id) {
        var js,
          sjs = d.getElementsByTagName(s)[0];
        if (d.getElementById(id)) return;
        js = d.createElement(s);
        js.id = id;
        js.src = "https://sdk.snapkit.com/js/v1/login.js";
        sjs.parentNode.insertBefore(js, sjs);
      })(document, "script", "loginkit-sdk");
    </script>

Unfortunately, even with the above method, I am still encountering the same issue. I have raised this problem with the support team and am eagerly awaiting their response. Any guidance from your end would be greatly appreciated.

Answer №1

After facing a similar problem, I finally identified the root cause:

If you are in the process of developing or testing your application and using your staging ClientID, it is necessary to include your username as a Demo User in the developer portal.

Answer №2

While dealing with the Snapchat API, I encountered a similar challenge. The root of the problem was traced back to the redirect_uri, which had mistakenly been set as http instead of https.

Snapchat mandates the use of https for the redirect URL. Once I rectified this by updating the redirect_uri to utilize https, all operations functioned seamlessly, enabling me to progress beyond the login stage.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Experiencing issues with Firebase authentication on Nuxt app when refreshing the page for beginners

Despite my efforts of trying numerous examples and methods, I am still stuck in this situation - I have been struggling with it for the past 2 days now... The issue I am facing is that my app functions properly when I log in and click on links, but if I re ...

Bidirectional Communication between ExpressJS and Mongoose Models

Let's consider a scenario where we have a User model and a Book model in our express app, both referencing each other. How can mongoose middleware be utilized to ensure that both models stay synchronized when saving either one? It would be beneficial ...

Uncovering the Issue with Select All Functionality in <Table/> when using Material-UI and React

When using Material-UI's <Table/> with ReactJS, a table is set up with a select all checkbox. Each time an individual row checkbox is clicked, the row id is added to the state array clickedRowIds. This allows for logging of the ids of the clicke ...

Secure verification is a critical element within the core component of React JS

Creating a user-based application using Meteor (v1.3) requires strong authentication and authorization mechanisms. I found an insightful example by the author of Flow Router that delves into setting up authentication and authorization using Flow Router. h ...

Animating avatars with Three.js

Seeking some guidance on utilizing the three.js library for creating animations. Specifically, I am interested in animating an avatar that has been exported from Blender to Collada format (.dae), to move an arm or a leg. I would like to achieve this anim ...

How can the executable path for Firefox be specified in Nightwatch?

I've been using nightwatch to run tests on both Chrome and Firefox with great success. While everything runs smoothly on Chrome, I'm facing an issue when trying to run tests on Firefox on my personal machine. Currently, due to Marionette's ...

Exploring the World of Vue.js Object Imports

I am currently encountering an issue involving the importing of Objects from App.vue into a component. To provide context, this project consists of a Navigation Drawer component and an App.vue file. The Navigation Drawer contains Vue props that can be dyna ...

updateOne is limited to updating a single field at a time and does not have the capability to generate new fields within

I have encountered an issue with my NodeJs and MongoDB atlas setup while trying to save/update user profiles. The updateOne method seems to only update a single field at a time instead of the entire record. Here is the relevant code snippet: app.post(" ...

Is it possible for me to interact with different elements upon hovering?

html, <div id="first"> <a>Click here</a> </div> <div id=second"> second div content </div> css, #first a:hover{ color:blue; /*change color on hover */ #second{ background:blue; } } In ...

Having trouble concealing the logout button even after signing out with ng-show in angularjs

The code for displaying the logout button is as follows: <li class="dropdown" data-ng-if="userName"> <a href class="dropdown-toggle clear" data-toggle="dropdown" data-ng-show="userName"> </a> <!-- dropdown --> <u ...

Ways to address memory leakage issues in Angular

Is there a way to manually optimize the Garbage Collector by forcefully pushing variables into it? For example, if we have a root or global level variable in an Angular component that is no longer needed when switching to another page, how can we ensure it ...

Is there a way to ensure that both new Date() and new Date("yyyy-mm-dd hh:mm:ss") are initialized with the same timezone?

When utilizing both constructors, I noticed that they generate with different timezones. Ideally, they should be in the same timezone to ensure accurate calculations between them. I attempted to manually parse today's date and time, but this feels li ...

Theme.breakpoints.down not being acknowledged by MUI breakpoints

The Challenge: Implement a hamburger menu to replace the navMenu on tablet and smaller screens After successfully compiling in VS code terminal, encountering an error in the browser: Error Message: TypeError: Cannot read properties of undefined (reading ...

Collapsed on Load Vertical Collapsible Panel - Initially hidden panel on page load

Is there a way to load a <div> already collapsed when the page first loads? You can find my progress so far in this JS Fidle. HTML <button id="aa">Toggle it up</button> <div id="test">TEST</div> CSS div { background ...

The express.js and passport.js middleware in my application are functioning properly and executing as expected, however, there seems to be an issue with the

I have been working on developing a node/express server and decided to implement passport-local for user authentication using a local MongoDB server. I am encountering an issue where the page does not redirect as expected after submitting the login form wi ...

Is there a way to asynchronously load multiple textures in three.js using a callback function?

Bringing in a single texture with a callback is a simple task, for instance: var loader = new THREE.TextureLoader(); var texture1 = loader.load("https://i.imgur.com/UiTMJzv.png", process); //executed only once texture1 is loaded function process(){ } B ...

Bootstrap5: Left-aligned Navigation Bar Pills and Right-aligned Text

I am trying to align all my navigation pills to the left, and then add a single text element that stays at the end of the navbar even when the page is resized. Navbar Image My attempt involved adding a div so that the navbar pills would take up 50% width ...

Combining Node.js and Express to display error and success modals simultaneously in case of errors

I'm currently working on web development using Node.js and Express, while also exploring Reactive Programming with the libraries recommended by my seniors. My specific task at the moment involves creating a Change Password form for users. This form sh ...

Are you still relying on outdated endpoint pagination with Vue and Laravel?

Currently, I am in the process of transitioning a Laravel app from using Blade files to implementing Vue. In one part of the app, we had used pagination for displaying users with a page parameter at the end of the endpoint URL. For instance: /store/api ...

Why do browsers fail to cache Java scripts (Ajax) properly?

After creating a cascade drop-down list box with JQuery, the user can choose a state from the first drop-down and then the second drop-down will be filled with the relevant cities based on the selected state. However, I am facing an issue with caching in ...