Android - communication with Laravel API












0














I'm writing an Android app that communicates with a Laravel API using JSON calls. It should also support register and login. I've been searching for some tutorial/example on how to do this, but the only one I found is this one: https://github.com/ProgrammationAndroid/Laravel-Passport-Android



But the video is french and it's also slightly outdated. I'm pretty sure there must be plenty of tutorials/examples on how to do this but it just can't find them. Maybe someone can point me in the right direction? I don't need to write the API itself, only calling the API from an Android client.










share|improve this question






















  • Did you even google it? I found this on the first search medium.com/modulr/…. Also check laracast and/or codecourse for en tutorials.
    – Indra
    Nov 12 '18 at 9:59










  • I found that one, but that is about writing the API, as I said I don't need to write the API, I need to call the API from Android. And this page doesn't even contain the word "android".
    – 0ne_Up
    Nov 12 '18 at 10:12
















0














I'm writing an Android app that communicates with a Laravel API using JSON calls. It should also support register and login. I've been searching for some tutorial/example on how to do this, but the only one I found is this one: https://github.com/ProgrammationAndroid/Laravel-Passport-Android



But the video is french and it's also slightly outdated. I'm pretty sure there must be plenty of tutorials/examples on how to do this but it just can't find them. Maybe someone can point me in the right direction? I don't need to write the API itself, only calling the API from an Android client.










share|improve this question






















  • Did you even google it? I found this on the first search medium.com/modulr/…. Also check laracast and/or codecourse for en tutorials.
    – Indra
    Nov 12 '18 at 9:59










  • I found that one, but that is about writing the API, as I said I don't need to write the API, I need to call the API from Android. And this page doesn't even contain the word "android".
    – 0ne_Up
    Nov 12 '18 at 10:12














0












0








0







I'm writing an Android app that communicates with a Laravel API using JSON calls. It should also support register and login. I've been searching for some tutorial/example on how to do this, but the only one I found is this one: https://github.com/ProgrammationAndroid/Laravel-Passport-Android



But the video is french and it's also slightly outdated. I'm pretty sure there must be plenty of tutorials/examples on how to do this but it just can't find them. Maybe someone can point me in the right direction? I don't need to write the API itself, only calling the API from an Android client.










share|improve this question













I'm writing an Android app that communicates with a Laravel API using JSON calls. It should also support register and login. I've been searching for some tutorial/example on how to do this, but the only one I found is this one: https://github.com/ProgrammationAndroid/Laravel-Passport-Android



But the video is french and it's also slightly outdated. I'm pretty sure there must be plenty of tutorials/examples on how to do this but it just can't find them. Maybe someone can point me in the right direction? I don't need to write the API itself, only calling the API from an Android client.







android laravel






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 12 '18 at 9:56









0ne_Up

3062417




3062417












  • Did you even google it? I found this on the first search medium.com/modulr/…. Also check laracast and/or codecourse for en tutorials.
    – Indra
    Nov 12 '18 at 9:59










  • I found that one, but that is about writing the API, as I said I don't need to write the API, I need to call the API from Android. And this page doesn't even contain the word "android".
    – 0ne_Up
    Nov 12 '18 at 10:12


















  • Did you even google it? I found this on the first search medium.com/modulr/…. Also check laracast and/or codecourse for en tutorials.
    – Indra
    Nov 12 '18 at 9:59










  • I found that one, but that is about writing the API, as I said I don't need to write the API, I need to call the API from Android. And this page doesn't even contain the word "android".
    – 0ne_Up
    Nov 12 '18 at 10:12
















Did you even google it? I found this on the first search medium.com/modulr/…. Also check laracast and/or codecourse for en tutorials.
– Indra
Nov 12 '18 at 9:59




Did you even google it? I found this on the first search medium.com/modulr/…. Also check laracast and/or codecourse for en tutorials.
– Indra
Nov 12 '18 at 9:59












I found that one, but that is about writing the API, as I said I don't need to write the API, I need to call the API from Android. And this page doesn't even contain the word "android".
– 0ne_Up
Nov 12 '18 at 10:12




I found that one, but that is about writing the API, as I said I don't need to write the API, I need to call the API from Android. And this page doesn't even contain the word "android".
– 0ne_Up
Nov 12 '18 at 10:12












1 Answer
1






active

oldest

votes


















-1















Laravel Passport / OAuth 2.0



Laravel makes API authentication a breeze using Laravel Passport, which provides a full OAuth2 server implementation.





Grants



The OAuth 2.0 specification is a flexibile authorization framework that describes a number of grants (“methods”) for a client application to acquire an access token (which represents a user’s permission for the client to access their data) which can be used to authenticate a request to an API endpoint.




  1. Authorization code grant

  2. Implicit grant

  3. Resource owner credentials grant

  4. Client credentials grant

  5. Password grant

  6. Refresh token grant



Which OAuth 2.0 grant should I use?



A grant is a method of acquiring an access token. Deciding which grants to implement depends on the type of client the end user will be using, and the experience you want for your users.




Grants





Implementation (1st party / Native app / Password grant)



Create an application



Passport will prompt you for more information about your client and will provide you with a client ID and secret :



php artisan passport:client --password


Requesting tokens



# http://laravel-app.tld/oauth/token
[
'grant_type' => 'password' # Grant type
'client_id' => 'client-id' # Application client ID
'client_secret' => 'client-secret' # Application client secret
'username' => 'email@domain.tld' # Form request
'password' => 's3cr3T' # Form request
'scope' => '*' # Scopes
]





share|improve this answer





















  • I don't need to write the API itself. I'm looking for information on how to connect to it from Android. I know what the JSON needs to look like but I'm looking for examples on how to implement this in Android.
    – 0ne_Up
    Nov 12 '18 at 11:06










  • @0ne_Up my answer is not to create an API, but a way to connect your API with Andoroid by using OAuth. Didn't you read it?
    – Wahyu Kristianto
    Nov 13 '18 at 1:04










  • partially, but I don't see anything about Android, just stuff about OAuth in general. Maybe I should be searching for "android oauth" and this is the stuff I should be reading?
    – 0ne_Up
    Nov 13 '18 at 8:18










  • You need to learn more about difference between OAuth & API, before you asking it.
    – Wahyu Kristianto
    Dec 3 '18 at 9:28











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53259672%2fandroid-communication-with-laravel-api%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









-1















Laravel Passport / OAuth 2.0



Laravel makes API authentication a breeze using Laravel Passport, which provides a full OAuth2 server implementation.





Grants



The OAuth 2.0 specification is a flexibile authorization framework that describes a number of grants (“methods”) for a client application to acquire an access token (which represents a user’s permission for the client to access their data) which can be used to authenticate a request to an API endpoint.




  1. Authorization code grant

  2. Implicit grant

  3. Resource owner credentials grant

  4. Client credentials grant

  5. Password grant

  6. Refresh token grant



Which OAuth 2.0 grant should I use?



A grant is a method of acquiring an access token. Deciding which grants to implement depends on the type of client the end user will be using, and the experience you want for your users.




Grants





Implementation (1st party / Native app / Password grant)



Create an application



Passport will prompt you for more information about your client and will provide you with a client ID and secret :



php artisan passport:client --password


Requesting tokens



# http://laravel-app.tld/oauth/token
[
'grant_type' => 'password' # Grant type
'client_id' => 'client-id' # Application client ID
'client_secret' => 'client-secret' # Application client secret
'username' => 'email@domain.tld' # Form request
'password' => 's3cr3T' # Form request
'scope' => '*' # Scopes
]





share|improve this answer





















  • I don't need to write the API itself. I'm looking for information on how to connect to it from Android. I know what the JSON needs to look like but I'm looking for examples on how to implement this in Android.
    – 0ne_Up
    Nov 12 '18 at 11:06










  • @0ne_Up my answer is not to create an API, but a way to connect your API with Andoroid by using OAuth. Didn't you read it?
    – Wahyu Kristianto
    Nov 13 '18 at 1:04










  • partially, but I don't see anything about Android, just stuff about OAuth in general. Maybe I should be searching for "android oauth" and this is the stuff I should be reading?
    – 0ne_Up
    Nov 13 '18 at 8:18










  • You need to learn more about difference between OAuth & API, before you asking it.
    – Wahyu Kristianto
    Dec 3 '18 at 9:28
















-1















Laravel Passport / OAuth 2.0



Laravel makes API authentication a breeze using Laravel Passport, which provides a full OAuth2 server implementation.





Grants



The OAuth 2.0 specification is a flexibile authorization framework that describes a number of grants (“methods”) for a client application to acquire an access token (which represents a user’s permission for the client to access their data) which can be used to authenticate a request to an API endpoint.




  1. Authorization code grant

  2. Implicit grant

  3. Resource owner credentials grant

  4. Client credentials grant

  5. Password grant

  6. Refresh token grant



Which OAuth 2.0 grant should I use?



A grant is a method of acquiring an access token. Deciding which grants to implement depends on the type of client the end user will be using, and the experience you want for your users.




Grants





Implementation (1st party / Native app / Password grant)



Create an application



Passport will prompt you for more information about your client and will provide you with a client ID and secret :



php artisan passport:client --password


Requesting tokens



# http://laravel-app.tld/oauth/token
[
'grant_type' => 'password' # Grant type
'client_id' => 'client-id' # Application client ID
'client_secret' => 'client-secret' # Application client secret
'username' => 'email@domain.tld' # Form request
'password' => 's3cr3T' # Form request
'scope' => '*' # Scopes
]





share|improve this answer





















  • I don't need to write the API itself. I'm looking for information on how to connect to it from Android. I know what the JSON needs to look like but I'm looking for examples on how to implement this in Android.
    – 0ne_Up
    Nov 12 '18 at 11:06










  • @0ne_Up my answer is not to create an API, but a way to connect your API with Andoroid by using OAuth. Didn't you read it?
    – Wahyu Kristianto
    Nov 13 '18 at 1:04










  • partially, but I don't see anything about Android, just stuff about OAuth in general. Maybe I should be searching for "android oauth" and this is the stuff I should be reading?
    – 0ne_Up
    Nov 13 '18 at 8:18










  • You need to learn more about difference between OAuth & API, before you asking it.
    – Wahyu Kristianto
    Dec 3 '18 at 9:28














-1












-1








-1







Laravel Passport / OAuth 2.0



Laravel makes API authentication a breeze using Laravel Passport, which provides a full OAuth2 server implementation.





Grants



The OAuth 2.0 specification is a flexibile authorization framework that describes a number of grants (“methods”) for a client application to acquire an access token (which represents a user’s permission for the client to access their data) which can be used to authenticate a request to an API endpoint.




  1. Authorization code grant

  2. Implicit grant

  3. Resource owner credentials grant

  4. Client credentials grant

  5. Password grant

  6. Refresh token grant



Which OAuth 2.0 grant should I use?



A grant is a method of acquiring an access token. Deciding which grants to implement depends on the type of client the end user will be using, and the experience you want for your users.




Grants





Implementation (1st party / Native app / Password grant)



Create an application



Passport will prompt you for more information about your client and will provide you with a client ID and secret :



php artisan passport:client --password


Requesting tokens



# http://laravel-app.tld/oauth/token
[
'grant_type' => 'password' # Grant type
'client_id' => 'client-id' # Application client ID
'client_secret' => 'client-secret' # Application client secret
'username' => 'email@domain.tld' # Form request
'password' => 's3cr3T' # Form request
'scope' => '*' # Scopes
]





share|improve this answer













Laravel Passport / OAuth 2.0



Laravel makes API authentication a breeze using Laravel Passport, which provides a full OAuth2 server implementation.





Grants



The OAuth 2.0 specification is a flexibile authorization framework that describes a number of grants (“methods”) for a client application to acquire an access token (which represents a user’s permission for the client to access their data) which can be used to authenticate a request to an API endpoint.




  1. Authorization code grant

  2. Implicit grant

  3. Resource owner credentials grant

  4. Client credentials grant

  5. Password grant

  6. Refresh token grant



Which OAuth 2.0 grant should I use?



A grant is a method of acquiring an access token. Deciding which grants to implement depends on the type of client the end user will be using, and the experience you want for your users.




Grants





Implementation (1st party / Native app / Password grant)



Create an application



Passport will prompt you for more information about your client and will provide you with a client ID and secret :



php artisan passport:client --password


Requesting tokens



# http://laravel-app.tld/oauth/token
[
'grant_type' => 'password' # Grant type
'client_id' => 'client-id' # Application client ID
'client_secret' => 'client-secret' # Application client secret
'username' => 'email@domain.tld' # Form request
'password' => 's3cr3T' # Form request
'scope' => '*' # Scopes
]






share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 12 '18 at 10:31









Wahyu Kristianto

2,91042950




2,91042950












  • I don't need to write the API itself. I'm looking for information on how to connect to it from Android. I know what the JSON needs to look like but I'm looking for examples on how to implement this in Android.
    – 0ne_Up
    Nov 12 '18 at 11:06










  • @0ne_Up my answer is not to create an API, but a way to connect your API with Andoroid by using OAuth. Didn't you read it?
    – Wahyu Kristianto
    Nov 13 '18 at 1:04










  • partially, but I don't see anything about Android, just stuff about OAuth in general. Maybe I should be searching for "android oauth" and this is the stuff I should be reading?
    – 0ne_Up
    Nov 13 '18 at 8:18










  • You need to learn more about difference between OAuth & API, before you asking it.
    – Wahyu Kristianto
    Dec 3 '18 at 9:28


















  • I don't need to write the API itself. I'm looking for information on how to connect to it from Android. I know what the JSON needs to look like but I'm looking for examples on how to implement this in Android.
    – 0ne_Up
    Nov 12 '18 at 11:06










  • @0ne_Up my answer is not to create an API, but a way to connect your API with Andoroid by using OAuth. Didn't you read it?
    – Wahyu Kristianto
    Nov 13 '18 at 1:04










  • partially, but I don't see anything about Android, just stuff about OAuth in general. Maybe I should be searching for "android oauth" and this is the stuff I should be reading?
    – 0ne_Up
    Nov 13 '18 at 8:18










  • You need to learn more about difference between OAuth & API, before you asking it.
    – Wahyu Kristianto
    Dec 3 '18 at 9:28
















I don't need to write the API itself. I'm looking for information on how to connect to it from Android. I know what the JSON needs to look like but I'm looking for examples on how to implement this in Android.
– 0ne_Up
Nov 12 '18 at 11:06




I don't need to write the API itself. I'm looking for information on how to connect to it from Android. I know what the JSON needs to look like but I'm looking for examples on how to implement this in Android.
– 0ne_Up
Nov 12 '18 at 11:06












@0ne_Up my answer is not to create an API, but a way to connect your API with Andoroid by using OAuth. Didn't you read it?
– Wahyu Kristianto
Nov 13 '18 at 1:04




@0ne_Up my answer is not to create an API, but a way to connect your API with Andoroid by using OAuth. Didn't you read it?
– Wahyu Kristianto
Nov 13 '18 at 1:04












partially, but I don't see anything about Android, just stuff about OAuth in general. Maybe I should be searching for "android oauth" and this is the stuff I should be reading?
– 0ne_Up
Nov 13 '18 at 8:18




partially, but I don't see anything about Android, just stuff about OAuth in general. Maybe I should be searching for "android oauth" and this is the stuff I should be reading?
– 0ne_Up
Nov 13 '18 at 8:18












You need to learn more about difference between OAuth & API, before you asking it.
– Wahyu Kristianto
Dec 3 '18 at 9:28




You need to learn more about difference between OAuth & API, before you asking it.
– Wahyu Kristianto
Dec 3 '18 at 9:28


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53259672%2fandroid-communication-with-laravel-api%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

Hercules Kyvelos

Tangent Lines Diagram Along Smooth Curve

Yusuf al-Mu'taman ibn Hud