All Projects → VientoDigital → Reactnativelaravellogin

VientoDigital / Reactnativelaravellogin

Sample App for login using laravel 5.5 React Native and Redux

Programming Languages

javascript
184084 projects - #8 most used programming language
flow
126 projects

Projects that are alternatives of or similar to Reactnativelaravellogin

Passport Social Grant
Stars: ✭ 114 (+52%)
Mutual labels:  laravel, passport
Laravel Authz
An authorization library that supports access control models like ACL, RBAC, ABAC in Laravel.
Stars: ✭ 136 (+81.33%)
Mutual labels:  laravel, passport
Laravel Tenancy Passport Demo
Laravel demo with Passport and Tenancy
Stars: ✭ 107 (+42.67%)
Mutual labels:  laravel, passport
Poetryclub Backend
基于 laravel + vue.js 的诗词小筑网站后台页面与后端代码
Stars: ✭ 87 (+16%)
Mutual labels:  laravel, passport
Laravel template with vue
laravel5.5和vue.js结合的前后端分离项目模板,后端使用了laravel的LTS版本(5.5),前端使用了流行的vue-element-template项目。作为程序的起点,可以直接以此为基础来进行业务扩展。模板内容包括基础的用户管理和权限管理、日志管理、集成第三方登录,整合laravel-echo-server 实现了websocket 做到了消息的实时推送,并在此基础上,实现了聊天室和客服功能。权限管理包括后端Token认证和前端vue.js的动态权限,解决了前后端完整分离的情况下,vue.js的认证与权限相关的痛点,已在本人的多个项目中集成使用。
Stars: ✭ 763 (+917.33%)
Mutual labels:  laravel, passport
Laravel Passport Social Grant
🔒 API authentication via social networks for your Laravel application
Stars: ✭ 142 (+89.33%)
Mutual labels:  laravel, passport
Laravel Passport Android
Laravel + Passport for an Android App
Stars: ✭ 116 (+54.67%)
Mutual labels:  laravel, passport
Laravel Janitor
🔑 Easily add login proxy to your Laravel API
Stars: ✭ 54 (-28%)
Mutual labels:  laravel, passport
Roastapp
Laravel学院 Roast 应用源码
Stars: ✭ 164 (+118.67%)
Mutual labels:  laravel, passport
Larapush
artisan push - Deploy your codebase into your web server with one Laravel artisan command and no SSH needed!
Stars: ✭ 150 (+100%)
Mutual labels:  laravel, passport
Angular5.2 Laravel5.6
Angular 5.2 and Laravel 5.6 Authentication and CRUD
Stars: ✭ 17 (-77.33%)
Mutual labels:  laravel, passport
Redux Persist Expo Securestore
redux-persist storage for Expo's SecureStore
Stars: ✭ 61 (-18.67%)
Mutual labels:  redux-persist, expo
Talks
Apresentações da Laraconf Brasil
Stars: ✭ 72 (-4%)
Mutual labels:  laravel
Laravel Imageupload
Upload image using Laravel's build in function and resize it automatically.
Stars: ✭ 73 (-2.67%)
Mutual labels:  laravel
Laravel Queue Rabbitmq
RabbitMQ driver for Laravel Queue. Supports Laravel Horizon.
Stars: ✭ 1,175 (+1466.67%)
Mutual labels:  laravel
Laravel Review Rateable
Review & Rating System For Lavavel 5, 6 & 7
Stars: ✭ 72 (-4%)
Mutual labels:  laravel
Data Story
A visual process builder for Laravel
Stars: ✭ 71 (-5.33%)
Mutual labels:  laravel
Env Providers
👷 Load Laravel service providers based on your application's environment.
Stars: ✭ 73 (-2.67%)
Mutual labels:  laravel
Laravel Disqus
A simple Disqus platform integration with Laravel.
Stars: ✭ 71 (-5.33%)
Mutual labels:  laravel
Laravel Micro Manager
Oversee jobs you have put into the queue. Track status, completion % and other job information in real time.
Stars: ✭ 71 (-5.33%)
Mutual labels:  laravel

This project was bootstrapped with Create React Native App.

Below you'll find information about performing common tasks. The most recent version of this guide is available here.

Table of Contents

React Native Specific

Laravel 5.3+

ReactNativeLaravelLogin App

React Native Specific

Updating to New Releases

You should only need to update the global installation of create-react-native-app very rarely, ideally never.

Updating the react-native-scripts dependency of your app should be as simple as bumping the version number in package.json and reinstalling your project's dependencies.

Upgrading to a new version of React Native requires updating the react-native, react, and expo package versions, and setting the correct sdkVersion in app.json. See the versioning guide for up-to-date information about package version compatibility.

Available Scripts

If Yarn was installed when the project was initialized, then dependencies will have been installed via Yarn, and you should probably use it to run these commands as well. Unlike dependency installation, command running syntax is identical for Yarn and NPM at the time of this writing.

npm start

Runs your app in development mode.

Open it in the Expo app on your phone to view it. It will reload if you save edits to your files, and you will see build errors and logs in the terminal.

Sometimes you may need to reset or clear the React Native packager's cache. To do so, you can pass the --reset-cache flag to the start script:

npm start -- --reset-cache
# or
yarn start -- --reset-cache

npm test

Runs the jest test runner on your tests.

npm run ios

Like npm start, but also attempts to open your app in the iOS Simulator if you're on a Mac and have it installed.

npm run android

Like npm start, but also attempts to open your app on a connected Android device or emulator. Requires an installation of Android build tools (see React Native docs for detailed setup). We also recommend installing Genymotion as your Android emulator. Once you've finished setting up the native build environment, there are two options for making the right copy of adb available to Create React Native App:

Using Android Studio's adb
  1. Make sure that you can run adb from your terminal.
  2. Open Genymotion and navigate to Settings -> ADB. Select “Use custom Android SDK tools” and update with your Android SDK directory.
Using Genymotion's adb
  1. Find Genymotion’s copy of adb. On macOS for example, this is normally /Applications/Genymotion.app/Contents/MacOS/tools/.
  2. Add the Genymotion tools directory to your path (instructions for Mac, Linux, and Windows).
  3. Make sure that you can run adb from your terminal.

npm run eject

This will start the process of "ejecting" from Create React Native App's build scripts. You'll be asked a couple of questions about how you'd like to build your project.

Warning: Running eject is a permanent action (aside from whatever version control system you use). An ejected app will require you to have an Xcode and/or Android Studio environment set up.

Customizing App Display Name and Icon

You can edit app.json to include configuration keys under the expo key.

To change your app's display name, set the expo.name key in app.json to an appropriate string.

To set an app icon, set the expo.icon key in app.json to be either a local path or a URL. It's recommended that you use a 512x512 png file with transparency.

Writing and Running Tests

This project is set up to use jest for tests. You can configure whatever testing strategy you like, but jest works out of the box. Create test files in directories called __tests__ or with the .test extension to have the files loaded by jest. See the the template project for an example test. The jest documentation is also a wonderful resource, as is the React Native testing tutorial.

Environment Variables

You can configure some of Create React Native App's behavior using environment variables.

Configuring Packager IP Address

When starting your project, you'll see something like this for your project URL:

exp://192.168.0.2:19000

The "manifest" at that URL tells the Expo app how to retrieve and load your app's JavaScript bundle, so even if you load it in the app via a URL like exp://localhost:19000, the Expo client app will still try to retrieve your app at the IP address that the start script provides.

In some cases, this is less than ideal. This might be the case if you need to run your project inside of a virtual machine and you have to access the packager via a different IP address than the one which prints by default. In order to override the IP address or hostname that is detected by Create React Native App, you can specify your own hostname via the REACT_NATIVE_PACKAGER_HOSTNAME environment variable:

Mac and Linux:

REACT_NATIVE_PACKAGER_HOSTNAME='my-custom-ip-address-or-hostname' npm start

Windows:

set REACT_NATIVE_PACKAGER_HOSTNAME='my-custom-ip-address-or-hostname'
npm start

The above example would cause the development server to listen on exp://my-custom-ip-address-or-hostname:19000.

Adding Flow

Flow is a static type checker that helps you write code with fewer bugs. Check out this introduction to using static types in JavaScript if you are new to this concept.

React Native works with Flow out of the box, as long as your Flow version matches the one used in the version of React Native.

To add a local dependency to the correct Flow version to a Create React Native App project, follow these steps:

  1. Find the Flow [version] at the bottom of the included .flowconfig
  2. Run npm install --save-dev [email protected] (or yarn add --dev [email protected]), where x.y.z is the .flowconfig version number.
  3. Add "flow": "flow" to the scripts section of your package.json.
  4. Add // @flow to any files you want to type check (for example, to App.js).

Now you can run npm run flow (or yarn flow) to check the files for type errors. You can optionally use a plugin for your IDE or editor for a better integrated experience.

To learn more about Flow, check out its documentation.

Sharing and Deployment

Create React Native App does a lot of work to make app setup and development simple and straightforward, but it's very difficult to do the same for deploying to Apple's App Store or Google's Play Store without relying on a hosted service.

Publishing to Expo's React Native Community

Expo provides free hosting for the JS-only apps created by CRNA, allowing you to share your app through the Expo client app. This requires registration for an Expo account.

Install the exp command-line tool, and run the publish command:

$ npm i -g exp
$ exp publish

Building an Expo "standalone" app

You can also use a service like Expo's standalone builds if you want to get an IPA/APK for distribution without having to build the native code yourself.

Ejecting from Create React Native App

If you want to build and deploy your app yourself, you'll need to eject from CRNA and use Xcode and Android Studio.

This is usually as simple as running npm run eject in your project, which will walk you through the process. Make sure to install react-native-cli and follow the native code getting started guide for React Native.

Should I Use ExpoKit?

If you have made use of Expo APIs while working on your project, then those API calls will stop working if you eject to a regular React Native project. If you want to continue using those APIs, you can eject to "React Native + ExpoKit" which will still allow you to build your own native code and continue using the Expo APIs. See the ejecting guide for more details about this option.

Troubleshooting

Networking

If you're unable to load your app on your phone due to a network timeout or a refused connection, a good first step is to verify that your phone and computer are on the same network and that they can reach each other. Create React Native App needs access to ports 19000 and 19001 so ensure that your network and firewall settings allow access from your device to your computer on both of these ports.

Try opening a web browser on your phone and opening the URL that the packager script prints, replacing exp:// with http://. So, for example, if underneath the QR code in your terminal you see:

exp://192.168.0.1:19000

Try opening Safari or Chrome on your phone and loading

http://192.168.0.1:19000

and

http://192.168.0.1:19001

If this works, but you're still unable to load your app by scanning the QR code, please open an issue on the Create React Native App repository with details about these steps and any other error messages you may have received.

If you're not able to load the http URL in your phone's web browser, try using the tethering/mobile hotspot feature on your phone (beware of data usage, though), connecting your computer to that WiFi network, and restarting the packager.

iOS Simulator won't open

If you're on a Mac, there are a few errors that users sometimes see when attempting to npm run ios:

  • "non-zero exit code: 107"
  • "You may need to install Xcode" but it is already installed
  • and others

There are a few steps you may want to take to troubleshoot these kinds of errors:

  1. Make sure Xcode is installed and open it to accept the license agreement if it prompts you. You can install it from the Mac App Store.
  2. Open Xcode's Preferences, the Locations tab, and make sure that the Command Line Tools menu option is set to something. Sometimes when the CLI tools are first installed by Homebrew this option is left blank, which can prevent Apple utilities from finding the simulator. Make sure to re-run npm/yarn run ios after doing so.
  3. If that doesn't work, open the Simulator, and under the app menu select Reset Contents and Settings.... After that has finished, quit the Simulator, and re-run npm/yarn run ios.

QR Code does not scan

If you're not able to scan the QR code, make sure your phone's camera is focusing correctly, and also make sure that the contrast on the two colors in your terminal is high enough. For example, WebStorm's default themes may not have enough contrast for terminal QR codes to be scannable with the system barcode scanners that the Expo app uses.

If this causes problems for you, you may want to try changing your terminal's color theme to have more contrast, or running Create React Native App from a different terminal. You can also manually enter the URL printed by the packager script in the Expo app's search bar to load it manually.

Laravel 5.3+

Laravel - The PHP Framework For Web Artisans These are extracts from Laravel Site Documentation.

Install Laravel

Laravel utilizes Composer to manage its dependencies. So, before using Laravel, make sure you have Composer installed on your machine.

Via Composer Create-Project

composer create-project --prefer-dist laravel/laravel blog

Run your local Development Server

If you have PHP installed locally and you would like to use PHP's built-in development server to serve your application, you may use the serve Artisan command. This command will start a development server at http://localhost:8000

php artisan serve

Authentication Introduction

Want to get started fast? Just run php artisan make:auth and php artisan migrate in a fresh Laravel application. Then, navigate your browser to http://localhost:8000/register or any other URL that is assigned to your application. These two commands will take care of scaffolding your entire authentication system!

API Authentication

To get started, install Passport via the Composer package manager:

composer require laravel/passport

The Passport service provider registers its own database migration directory with the framework, so you should migrate your database after registering the provider. The Passport migrations will create the tables your application needs to store clients and access tokens:

php artisan migrate

Next, you should run the passport:install command. This command will create the encryption keys needed to generate secure access tokens. In addition, the command will create "personal access" and "password grant" clients which will be used to generate access tokens:

php artisan passport:install

After running this command, add the Laravel\Passport\HasApiTokens trait to your App\User model. This trait will provide a few helper methods to your model which allow you to inspect the authenticated user's token and scopes:

<?php

namespace App;

use Laravel\Passport\HasApiTokens;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable
{
    use HasApiTokens, Notifiable;
}

Next, you should call the Passport::routes method within the boot method of your AuthServiceProvider. This method will register the routes necessary to issue access tokens and revoke access tokens, clients, and personal access tokens:

<?php

namespace App\Providers;

use Laravel\Passport\Passport;
use Illuminate\Support\Facades\Gate;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;

class AuthServiceProvider extends ServiceProvider
{
    /**
     * The policy mappings for the application.
     *
     * @var array
     */
    protected $policies = [
        'App\Model' => 'App\Policies\ModelPolicy',
    ];

    /**
     * Register any authentication / authorization services.
     *
     * @return void
     */
    public function boot()
    {
        $this->registerPolicies();

        Passport::routes();
    }
}

Finally, in your config/auth.php configuration file, you should set the driver option of the api authentication guard to passport. This will instruct your application to use Passport's TokenGuard when authenticating incoming API requests:

'guards' => [
    'web' => [
        'driver' => 'session',
        'provider' => 'users',
    ],

    'api' => [
        'driver' => 'passport',
        'provider' => 'users',
    ],
],

Password Grant Tokens

The OAuth2 password grant allows your other first-party clients, such as a mobile application, to obtain an access token using an e-mail address / username and password. This allows you to issue access tokens securely to your first-party clients without requiring your users to go through the entire OAuth2 authorization code redirect flow.

Creating A Password Grant Client Before your application can issue tokens via the password grant, you will need to create a password grant client. You may do this using the passport:clientcommand with the --password option. If you have already run the passport:install command, you do not need to run this command:

php artisan passport:client --password

ReactNativeLaravelLogin App

What you get out of the box:

  1. React Native
  2. React Redux
  3. Redux Persist
  4. Login to Laravel API Authentication

Configuration

The App/Config folder contains getting started configuration needed.

URLs.js

const BASE_URL = 'http://localhost:8000'
export const LOGIN_URL = BASE_URL + '/oauth/token'

Settings.js

export const OAUTH_CLIENT_ID = **YOUR_ID**
export const OAUTH_CLIENT_SECRECT = '**YOUR_SECRET_KEY**'

That's it! Try your App

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].