You are not logged in.

Announcement

*** NOTICE: forum.openstreetmap.org is being retired. Please request a category for your community in the new ones as soon as possible using this process, which will allow you to propose your community moderators.
Please create new topics on the new site at community.openstreetmap.org. We expect the migration of data will take a few weeks, you can follow its progress here.***

#1 2011-01-09 17:40:17

paule85
Member
Registered: 2011-01-09
Posts: 7

Http Auth via Ajax

Hello I am really new in OSM and I have my first problem. ^^
I want to develop a webapplication and my first step is that the user has to login. I want to use Ajax here but i do not know what URL I need to connect to the OSM Database. I thought that I have to go to the user details as you can see in the code. I use the "prototype.js" for the Ajax method. There is no error but I can connect with every name which is not right as you can imagine. I think that I do not have a right connection but why ?

Can anyone help me ?

That is my code:


var standardUrl = 'http://api.openstreetmap.org/';

function checkLogin(){

    var url = standardUrl + 'api/0.6/user/details';
    var params = new Object();

    params["userName"] = userName;
    params["userPassword"] = pwd;


    new Ajax.Request(url, {

        method: 'get',
        parameters: params,
        onSuccess: function(transport){
            var response = transport.responseText;
            // xmlOsmUser = response;
            if(trim(response) != "Couldn't authenticate you"){
                document.getElementById("formular").style.visibility = 'hidden';
                document.getElementById("login").style.visibility = 'hidden';               
                document.getElementById("logout").style.visibility ='visible';
                document.getElementById("logout").innerHTML = " "+ userName +" ";
                document.getElementById("logoutButton").style.visibility ='visible';
            }
            else
                alert("Blablabla!");
        },
        onFailure: function() {
    
            alert("Fehler");
            return "-1";
        },
        onException: function(request, exception) {
            alert("mist: " + exception + request);
            return "-1";
        }


    });

Offline

#2 2011-01-28 12:41:36

paule85
Member
Registered: 2011-01-09
Posts: 7

Re: Http Auth via Ajax

This is solved. thx

Offline

#3 2011-01-28 14:15:33

PHerison
Member
From: Rhein-Main
Registered: 2008-04-04
Posts: 1,770

Re: Http Auth via Ajax

More details about the solution of your problem might be helpfull for others...

Last edited by PHerison (2011-01-28 14:15:49)

Offline

#4 2011-01-28 14:48:10

Lambertus
Inactive
From: Apeldoorn (NL)
Registered: 2007-03-17
Posts: 3,269
Website

Re: Http Auth via Ajax

The forum uses an API function to check if the supplied username/password combo is correct...

api/0.6/user/details


Mapping tools: Garmin GPSmap 60CSx, Giant Terrago 2002

Offline

#5 2011-01-28 17:24:10

paule85
Member
Registered: 2011-01-09
Posts: 7

Re: Http Auth via Ajax

That is one option. I check the user and pwd when the user starts to create a node so when I get the changesetid. When the response is =="Couldn't authenticate you" then something is wrong.

Offline

Board footer

Powered by FluxBB