2

I am trying to use nopCommerce API for one of our mobile app. We have successfully done with website.

For mobile app, first step to run the api is to get access token. To generate access token we understand we need to use oAuth 2.0. We successfully generate token using Postman.

For iPhone/ Android we are trying to generate token.

Could someone suggest what should we use? Do we need to use Google oAuth for nopCommerce access token?

Fahim Parkar
  • 30,974
  • 45
  • 160
  • 276
  • For a mobile app, you need to code to generate the token and that you can use for consuming the APIs. I'm not sure what do you mean by *Do we need to use Google oAuth for nopCommerce* because you've already token now and you just need to pass to the server. – Divyang Desai Apr 14 '19 at 16:31
  • @Div : I am looking for `you need to code to generate the token`. Can you pass me link for sample? What I found are library for oAuth2.0 for Google authentication. – Fahim Parkar Apr 14 '19 at 18:25
  • I recommended you to use [nopCommerce API plugin](https://github.com/SevenSpikes/api-plugin-for-nopcommerce), which will helps in api authentication. Here is the sample code for token generation https://github.com/SevenSpikes/nopCommerce-Api-SampleApplication – Divyang Desai Apr 15 '19 at 04:37
  • @Div : The sample they provided is for .NET. I am looking for sample in Swift or Java – Fahim Parkar Apr 15 '19 at 05:45
  • What version of nopCommerce are you using? Also, you can create token via API, you should not write token generation code in your mobile app for security reason – Divyang Desai Apr 15 '19 at 05:59
  • @Div : Version 4.10 – Fahim Parkar Apr 15 '19 at 07:08
  • Okay, thanks for letting me know! Token creation and validation should be done on server only. – Divyang Desai Apr 15 '19 at 07:19
  • @Div : Is there ready API already or our developer have to make it? – Fahim Parkar Apr 15 '19 at 07:31
  • @Div : We tried with Postman and it is successfull. So we was trying to get access token from mobile programming side. – Fahim Parkar Apr 15 '19 at 07:32
  • I'm not sure what you have tried with Postman, but Postman doesn't responsible for generating tokens, it will just send http request and give you a result. – Divyang Desai Apr 15 '19 at 07:35
  • @Div : Is there ready API already or our developer have to make it? – Fahim Parkar Apr 15 '19 at 07:49
  • If you're using the same plugin (upper link), then you'd need to create an API from a sample code, and it won't take much time! – Divyang Desai Apr 15 '19 at 08:03
  • @FahimParkar Did you ever figure this out? I am looking to do the same in swift. If so do you have sample code that you can share? – CodeMan03 Jun 09 '20 at 05:06
  • @CodeMan03 : nope. we create a token with validity of 15 years and using that. Token has to be created using API. – Fahim Parkar Jun 09 '20 at 11:35

0 Answers0