0

I am using Vue Native with Firebase and try to make Firebase Auth work.
However, i can't.

I got this error message.

this operation is not supported in the environment this application is running on. location.protocol

I use Firebase Web SDK.

$ yarn add firebase

and I know what this error message means.

This application is native App and not running on http/https of course.

So what should I do to use Firebase with Vue Native?

Thanks in advance.

My code is here↓

<template>


<view class="container">
<button
  :on-press="signInWithGoogle"
  title="Sign In"
  color="#841584"
/>
</view>
</template>

<script>

import firebase from 'firebase';

const config = {
  apiKey: "API-KEY",
  authDomain: "authDomain",
  databaseURL: "databaseURL",
  projectId: "projectId",
  storageBucket: "storageBucket",
  messagingSenderId: "messagingSenderId"
};

const app = firebase.initializeApp(config);
const provider = new firebase.auth.GoogleAuthProvider();

export default {
  methods: {
    signInWithGoogle() {
      firebase.auth().signInWithRedirect(provider);
    }
  }

}

1

1 Answer 1

1

You can use react-native-firebase.

You can install using yarn

yarn add react-native-firebase

And start using their API as documented here.

You should use --no-crna when init'ing your project.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.