Signing up with Github instead of Signing In, even if there is already a logged in user

Hi!
My application allows users to either Sign Up or Sign In with Github. However, if a user is already logged in via github, they are silently authenticated and bypass Github’s login screen. This is a problem, because we want users with multiple github accounts to be able to login with their different accounts.

I tried setting “prompt” to “login” as described in the documentation for authorize, but it had no effect. Here is my code:

const signUpWithGithub = () => {
webAuth.authorize(
{
connection: ‘github’,
prompt: ‘login’,
},
function (err) {
if (err) displayError(err);
},
);
}
const loginWithGithub = () => {
webAuth.authorize(
{
connection: ‘github’,
},
function (err) {
if (err) displayError(err);
},
);
};

Any ideas what I could be missing?

Hi @zev_izenberg , welcome to the community!

This mainly depends on how GitHub handles a user who has a session already, the prompt: login you are currently using will only make Auth0 prompt the user to login again, but as soon as the user selects GitHub, it is down to how GitHub handles the authorization request.

In order to always prompt the user to login to a GitHub account, you could try passing the prompt: login parameter as an upstream parameter by adding it at the connection level:

Whilst prompt wasn’t listed as an option on the GitHub docs, it did appear to ask me to login to a GitHub account despite having a GitHub session when I tested it:

(I removed the second option I previously posted as I realised this would only work for scopes and not additional parameters)

Awesome, thanks so much for the reply. I’ll try those out.

1 Like

No worries! We’re here for you!