Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

160
Vistas
How to get username from authentication prompt popup

I have SharePoint Online classic page which has some custom JavaScript and jQuery scripts implemented and third party .NET app requiring some basic auth. When the user visits the page he is prompted to enter username and password. How can I get the username from this prompt? Prompt is standard and looks like this (picture is not mine) enter image description here

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

You can use SharePoint's javascript API to retrieve the current user's information.

_spPageContextInfo.userId

see: https://social.technet.microsoft.com/wiki/contents/articles/29766.sharepoint-understanding-the-sppagecontextinfo-object.aspx

Another suggestion is to use the API:

<script type="text/javascript">
ExecuteOrDelayUntilScriptLoaded(getCurrentUser, "sp.js");
 
var currentUser;
 
function getCurrentUser(){
var ctx= new SP.ClientContext.get_current();
var web = ctx.get_web();
currentUser = web.get_currentUser();
ctx.load(currentUser);
ctx.executeQueryAsync(onSuccess, onFailure);
}
 
function onSuccess() {
alert(currentUser.get_title()); // Domain\Account 
alert(currentUser.get_email());
document.getElementById('userLogin').innerHTML = currentUser.get_loginName(); 
}
 
function onFailure() {
alert('request failed' + args.get_message() + '\n' + args.get_stackTrace());
}
 
</script>
 
<div>Currently Logged User:
    <span id="userLogin"></span>
</div>

MS reference: https://docs.microsoft.com/en-us/sharepoint/dev/sp-add-ins/complete-basic-operations-using-sharepoint-client-library-code

about 4 years ago · Juan Pablo Isaza Denunciar

0

If someone is still interested in this I found a way to get the user principal name with microsoft graph API https://docs.microsoft.com/en-us/graph/api/user-get?view=graph-rest-1.0&tabs=http

https://graph.microsoft.com/v1.0/me?$select=mailnickname,onpremisesUserprincipalName was the actual request I needed

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda