Reputation: 1
I'm trying to use the OAuth Discord authentication with expo and I got the following error due to clicking on authorize
auth authorization screen auth error
I'm using the following code:
const discovery = {
authorizationEndpoint: "https://discord.com/oauth2/authorize",
};
const [request, response, promptAsync] = useAuthRequest(
{
responseType: RESPONSE_TYPE,
clientId: CLIENT_ID,
scopes: SCOPE,
redirectUri: REDIRECT_URI
},
discovery
);
const signIn = async () => {
try {
const response = await promptAsync();
if (response?.type === "success") {
console.log("TOKEN -------->" + response.params);
}
} catch (error) {
console.log("ERRO NO TOKEN -------->");
alert(error);
} finally {
console.log("CHAMADA FINALIZADA -------->");
console.log(response)
setLoading(false);
}
};
I tried using the makeRedirectUri()
method, but the only way that worked for me was registering the app on expo.dev and setting the redirectUri directly with the format: 'https://auth.expo.io/@<username >/<project_name>'
.
I suspect it might have something to do with the environment, but I couldn't find anything about it.
Upvotes: 0
Views: 189