Skip to content

Instantly share code, notes, and snippets.

krissanawat101 krissnawat

Block or report user

Report or block krissnawat

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View getToken.js
const fcmToken = await firebase.messaging().getToken();
if (fcmToken) {
console.log('fcmToken: ', fcmToken);
} else {
// user doesn't have a device token yet
View requestPermission.js
try {
await firebase.messaging().requestPermission();
// User has authorised
} catch (error) {
// User has rejected permissions
View hasPermission.js
.then(enabled => {
if (enabled) {
// user has permissions
} else {
// user doesn't have permission
View androidmanifest.xml
<service android:name="io.invertase.firebase.messaging.RNFirebaseMessagingService">
<action android:name="" /> </intent-filter>
<service android:name="io.invertase.firebase.messaging.RNFirebaseBackgroundMessagingService" />
View allowedOrigins.js
var allowedOrigins = ['http://localhost:3000',
origin: function(origin, callback){
// allow requests with no origin
// (like mobile apps or curl requests)
if(!origin) return callback(null, true);
if(allowedOrigins.indexOf(origin) === -1){
var msg = 'The CORS policy for this site does not ' +
'allow access from the specified Origin.';
View initilizeRecaptcha
<div className="form-group">
<label>Recaptcha Validation</label>
verifyCallback={response => {
setFieldValue("recaptcha", response);
onloadCallback={() => {
View app.js
import React, {Component} from 'react'
import Navigator from './src/components/Navigator'
import {ThemeManager} from './src/components/ThemeManager'
import SplashScreen from 'react-native-splash-screen'
import firebase from 'react-native-firebase'
import AsyncStorage from '@react-native-community/async-storage'
class App extends Component {
constructor (props) {
this.state = {}
View appdelegate.m
* Copyright (c) Facebook, Inc. and its affiliates.
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
#import "AppDelegate.h"
#import <React/RCTBridge.h>
View api.js
const express = require("express");
const router = express.Router();
const Users = require("./models/user_schema");
const jwt = require("./jwt");
const bcrypt = require("bcrypt");
const formidable = require("formidable");
const path = require("path");
const fs = require("fs-extra");
const jsonwebtoken = require("jsonwebtoken");
View passwordforgot.js"/password/reset", async (req, res) => {
let expired_time = "60m";
const { email } = req.body;
Users.findOne({ email }, (err, user) => {
if (err || !user) {
return res.json({
result: "error",
message: "User with that email does not exist"
You can’t perform that action at this time.