msal-browser component in react how to get only a access code

16 views Asked by At

Is it possible with msal-browser component to aquire only an access code (code) because I need to pass it to my service that code, and the service will handle further logic?

Also, my redirect_uri works in react, but what is the best way to present to user an information of success logging? using useEffect state if user is authorized?

example code:

async function doLogin(){
    var loginRequest = {
        scopes: ["offline_access",, "User.Read", "Calendars.ReadWrite"] // optional Array<string>
    };
    try {
        const loginResponse = await msalInstance.loginPopup(
            {
                redirectUri: "https://local:3001/testlogin"
                //loginRequest
            });
    } catch (err) {
        // handle error
    }
}
<Button onClick={async () => {await doLogin()} }/>
0

There are 0 answers