Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i cant able to sign out from azuare ad. am usseing this in react native web #206

Open
melbythomas opened this issue Jan 31, 2024 · 0 comments

Comments

@melbythomas
Copy link

melbythomas commented Jan 31, 2024

@vmurin @0xc14m1z Screenshot 2024-01-31 at 6 02 53 PM
when i trying to logout it will not rediret to my website

// msalInstance.js
import { PublicClientApplication } from "@azure/msal-browser";
import {CLIENT_ID,COGNITO_REDIRECT_URI_PART_THREE,COGNITO_REDIRECT_URI_HOST,COGNITO_REDIRECT_URI_HOST_DEVICE,
COGNITO_REDIRECT_URI_PART_TWO,COGNITO_REDIRECT_URI_PART_ONE,IDP} from '@env';
import { Platform } from "react-native";

const host = Platform.OS === 'web' ? COGNITO_REDIRECT_URI_HOST: COGNITO_REDIRECT_URI_HOST_DEVICE;

const msalConfig = {
auth: {
clientId: CLIENT_ID, // Replace with your Azure AD application client ID
authority: 'tenant_id'
redirectUri:'http://localhost:8080/sign-in
}
};

let instance: PublicClientApplication;
@ 0xc14m1z

export const getMsalInstance = () => {
if (!instance) {
instance = new PublicClientApplication(msalConfig);
}
return instance;
};
MY LOGOT call
const logout = async () => {
try {
console.error("Attempting to logout");
const msalInstance = getMsalInstance(); // Directly get the instance
await msalInstance.logoutRedirect();
console.error("Logout redirect called");
} catch (error) {
console.error("Logout error:", error);
}
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant