ubahnverleih / WoBike

Documentation of Bike Sharing APIs 🚴🛴🛵
952 stars 131 forks source link

Problem with the Bird API: Response 403 #194

Open lucaloeffler opened 3 years ago

lucaloeffler commented 3 years ago

Hey, I am trying right now to get my Authorization-Token but the API returns me an <Response: 403> The Email Adress I am using is also registered for an EU Bird Account. Can anyone help me with that?

def request_api():
    url = "https://api-auth.prod.birdapp.com/api/v1/auth/email"
    params = {
        "email":"<Email>"
    }
    headers = {
        "User-Agent": "Bird/4.53.0 (co.bird.Ride; build:24; iOS 12.4.1) Alamofire/4.53.0",
        "Platform": "ios",
        "App-Version": "4.53.0",
        "Content-Type": "application/json",
        "Device-Id": str(uuid.uuid4())
    }

    response = req.post(url, params = params, headers = headers)
    return response
BastelPichi commented 2 years ago

use response = req.post(url, json = params, headers = headers)

BastelPichi commented 2 years ago

Oh lol didnt figure out this is so old lol

Chrisphine10 commented 2 years ago

I have the same issue. It only works when I am using localhost. But the server IP returns an error 403.

private Integer postHandshake(String email, String uuid) throws IOException {
    JSONObject json = new JSONObject();
    json.put("email", email);
    Integer responseData = null;
    CloseableHttpClient httpClient = HttpClientBuilder.create().build();
    try {
        HttpPost request = new HttpPost(Constant.BIRD_API_GET_TOKEN_URL);
        StringEntity params = new StringEntity(json.toString());
        request.addHeader("Content-Type", Constant.JSON_CONTENT_TYPE);
        request.addHeader("Platform", Constant.BIRD_API_PLATFORM);
        request.addHeader("User-Agent", Constant.BIRD_API_USER_AGENT);
        request.addHeader("App-Version", Constant.BIRD_API_APP_VERSION);
        request.addHeader("Device-Id", uuid);
        request.setEntity(params);
        HttpResponse response = httpClient.execute(request);
        if (response != null) {
            responseData = response.getStatusLine().getStatusCode();
        }
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        httpClient.close();
    }
    return responseData;
}
BastelPichi commented 2 years ago

I have the same issue. It only works when I am using localhost. But the server IP returns an error 403.

private Integer postHandshake(String email, String uuid) throws IOException {
    JSONObject json = new JSONObject();
    json.put("email", email);
    Integer responseData = null;
    CloseableHttpClient httpClient = HttpClientBuilder.create().build();
    try {
        HttpPost request = new HttpPost(Constant.BIRD_API_GET_TOKEN_URL);
        StringEntity params = new StringEntity(json.toString());
        request.addHeader("Content-Type", Constant.JSON_CONTENT_TYPE);
        request.addHeader("Platform", Constant.BIRD_API_PLATFORM);
        request.addHeader("User-Agent", Constant.BIRD_API_USER_AGENT);
        request.addHeader("App-Version", Constant.BIRD_API_APP_VERSION);
        request.addHeader("Device-Id", uuid);
        request.setEntity(params);
        HttpResponse response = httpClient.execute(request);
        if (response != null) {
            responseData = response.getStatusLine().getStatusCode();
        }
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        httpClient.close();
    }
    return responseData;
}

Can you give me the variable definitions? For me it works fine. It also may be helpful to set the URL to a https://requestcatcher.com/ subdomain (visit the page for instructions), and then compare the output to the guide.

BastelPichi commented 1 year ago

Now i get it. Bird blocks most datacenter ips. Can we close this @ubahnverleih ?