'Snapchat API error: Something Went Wrong Invalid redirect_uri
I'm getting this snapchat error after trying to setup the api. It allows the user to login and then tells them of this issue. I have tried multiple redirect uris and none have worked so far. Does anyone have suggestions for how to solve this?
import Snap from './snap.js'
window.snapKitInit = function () {
var loginButtonIconId = "my-login-button-target";
// Mount Login Button
snap.loginkit.mountButton(loginButtonIconId, {
clientId: ID,
redirectURI: "https://socialdemo-b729a.web.app",
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
}
);
},
});
};
(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");
Solution 1:[1]
Something Went Wrong Invalid redirect_uri
Setup Redirct URI on Snapchat Developer Console
Initial Version
Redirect URIs for OAuth
your uri should be same in
in your metadata (application level)
<meta-data android:name="com.snapchat.kit.sdk.redirectUrl" android:value="Enter Your URI"/>
in Activity Level
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:scheme="hoopsnap" // here
android:host="snap-kit" // here
android:path="/oauth2"/> // here
</intent-filter>
Working properly for me
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Prafull Kumhar |