Logusid's avatar

How to pass api-token in url to get method

How to pass api-token in url to get method. please give me some example

0 likes
3 replies
agCepeda's avatar

You can pass it as param segment in the route.

Route::get("/api/{token}", function($token) {
    return $token;
});

or you can get the token through the request object like this

Route::get("/api", function(Request $request) {
    return $request->get("token", null);
});

but you can send the token in the query params of url like this

/api?token=1nx4dfe64wer

jekinney's avatar

Tokens are generally passed in the header. Authorization and prefixed with Bearer {token}

Just FYI

1 like

Please or to participate in this conversation.