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

How to ask Microsoft credentials on subsequent logins? #124

Open
MarcoBrugali opened this issue Jun 29, 2021 · 10 comments
Open

How to ask Microsoft credentials on subsequent logins? #124

MarcoBrugali opened this issue Jun 29, 2021 · 10 comments

Comments

@MarcoBrugali
Copy link

Hi all, is there a way to "clear the cache" so that on subsequent logins it asks me for my microsoft credentials in the webview?
I tried "clearSession", but the next time I log in it doesn't ask me for credentials

@vmurin
Copy link
Owner

vmurin commented Jun 29, 2021

Hi Marco,

please check out the sample app. If I logout there and then click login again - I'm always asked for credentials!
(tested on Android emulator)

@MarcoBrugali
Copy link
Author

Hi, i see in the example "azureAuth.webAuth.clearSession()" but at the next login not ask me credentials (test on ios emulator and android device)

@vmurin
Copy link
Owner

vmurin commented Jul 4, 2021

Have you tested with sample app or with you own only?

@0xc14m1z
Copy link

0xc14m1z commented Jul 5, 2021

It happens to me too, and I think that it is related to the other issue I opened. It doesn't ask for the credentials again because the clearSession doesn't actually resolve the logout. At least not on real devices.

@akshgods
Copy link

akshgods commented Jul 5, 2021

facing same issue, tested on real and emulator both android and ios.

@vmurin
Copy link
Owner

vmurin commented Jul 5, 2021

@0xc14m1z @akshgods Hi Guys, I can not see your code, so please check the behaviour based on test with the sample app!
Check it out, replace the client ID in the App.js and do the same test.
Otherwise I don't get what am I doing wrong :))) , so that in my tests all works as intended.

@MarcoBrugali
Copy link
Author

MarcoBrugali commented Jul 5, 2021

@vmurin I confirm, not even works for me requires credentials with the sample app.

this is my code, very simple:

import {isAndroid} from "../utils/dimension";

const azureAuth = new AzureAuth({
  clientId: '9ebaf856-026d-49bd-b26c-a026667b71e7',
  redirectUri: isAndroid ? 'msauth://com.gsm.buildings/Bfqg%2BiOTWf02SCYBvmmKK1qrtxM%3D' : 'msauth.com.gsm.buildings://auth',
  persistentCache: false,
});

export const getAzureToken = async () => {
  return await azureAuth.webAuth.authorize({scope: 'openid profile User.Read Mail.Read' })
}
export const logoutAzure = async () => {
  return await azureAuth.webAuth.clearSession({closeOnLoad: true})
}

I tried both with and without "persistCache" and "closeOnLoad"

@0xc14m1z
Copy link

0xc14m1z commented Jul 6, 2021

@vmurin I literally just cloned the sample app, changed the clientId and the bundle identifier to have the callback url to work. It doesn't log me out 😔

@vmurin
Copy link
Owner

vmurin commented Jul 6, 2021

I have just tested the sample app on the real device (Samsung S10). It works as intended. It asks me for credentials every time I click login button!!!

So my suggestion - there is something with the app registration...
@0xc14m1z Could you please check it up. Please run the sample app without any changes with my Client ID:
9e124cf5-641c-4f4d-907f-937714c66e3d

@SahilMoglix
Copy link

You can add prompt: 'login' in azureAuth.webAuth.authorize method.
let tokens = await azureAuth.webAuth.authorize({ prompt: 'login', scope: 'openid profile User.Read offline_access Calendars.Read', });

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

5 participants