Ionic Mobile App connected to ERPNext as backend

source : castlecraft / frappe-mobile-starter · GitLab

Example Retrieves user profile using token to prove API calls are made.

  • Uses frappe’s OAuth2 for authorization
  • Seamless session refresh with refresh token (for offline abilities)
  • Uses Ionic/Angular
  • Uses native http calls instead of cordova/browser calls to circumvent CORS
  • Minimum Unit tests and E2E tests to ensure API functionality and upgrades

Checkout README for more details

Note: Promises not entertained, only Observables :wink:

Update: 2019-12-15

Screenshots :

Home Page without login

Sidebar login

Login InAppBrowser

Home Page with profile

Sidebar Logout

Google account login (Update 2019-12-05)

11 Likes

Tried it out -

Im getting 417 (Expectation Failed) status from the server.
Any idea whats going on?

Sorry my bad its working now forgot to add social login key for frappe provider.

Everything seems to work but there are a bunch of errors in the console on login and logout -

navigator.splashscreen is not available in browser

That error can be ignored.

navigator.splashscreen.show() will work in cordova

edlt: fixed the errors

Use this app as starter. Do change the storage to something better in production.

Can you please share the frappe provider settings? Im getting the same 417 error from server.
Thank you

Add a social login key for frappe provider
Do not enable it.

forgot to add social login key for frappe provider.

https://frappe.io/docs/user/en/guides/integration/how_to_set_up_oauth#add-primary-server

1 Like

i have a question regarding oAuth2, can we use mobile App as Client to login to Google (as OAuth Auth. server), then send token to Frappe REST API (as Resource Server) ?

I read the document in Token Based Authentication , Mobile App client send the token to Frappe which this token seems as generated from frappe(as role of OAuth Auth. server), however, i would like to use google or facebook token to access frappe(as resource server), is it possible for this situation at frappe V12?

Frappe / ERPNext resources are only accessible with frappe’s OAuth Bearer Token

You cannot use any other token to access frappe resources.

If you are trying to have a seamless single login using gsuite or office365 then use Frappe’s Social Login Key feature. Add any of the providers. These providers will be available on Login page.

This app template redirects back to mobile client with frappe’s token even after you login via any provider.

example google login