<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Asim Mehmood</title>
    <description>The latest articles on DEV Community by Asim Mehmood (@asim_mehmood_275a2236b23e).</description>
    <link>https://dev.to/asim_mehmood_275a2236b23e</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3166104%2F57aa499c-8e7f-464e-98ba-b384118db75b.jpg</url>
      <title>DEV Community: Asim Mehmood</title>
      <link>https://dev.to/asim_mehmood_275a2236b23e</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/asim_mehmood_275a2236b23e"/>
    <language>en</language>
    <item>
      <title>Social Login using Gmail in Nest JS</title>
      <dc:creator>Asim Mehmood</dc:creator>
      <pubDate>Wed, 21 May 2025 10:38:13 +0000</pubDate>
      <link>https://dev.to/asim_mehmood_275a2236b23e/social-login-using-gmail-in-nest-js-44ii</link>
      <guid>https://dev.to/asim_mehmood_275a2236b23e/social-login-using-gmail-in-nest-js-44ii</guid>
      <description>&lt;p&gt;l Login using Gmail in Nest JS&lt;/p&gt;

&lt;p&gt;In this article, we will learn how to implement the social login feature in Nest js.&lt;/p&gt;

&lt;p&gt;1- Installation&lt;/p&gt;

&lt;p&gt;First of all, install the dependencies using following commands&lt;/p&gt;

&lt;p&gt;For NPM&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm i passport passport-facebook passport-google-oauth20
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For Yarn&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;yarn add passport passport-facebook passport-google-oauth20
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;2- Configuration&lt;/p&gt;

&lt;p&gt;In the src directory of your project, create a folder named “Services”. Create a googleStrategy.ts file in services folder.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { PassportStrategy } from '@nestjs/passport';
import { Strategy, VerifyCallback } from 'passport-google-oauth20';
import { config } from 'dotenv';
import { Injectable } from '@nestjs/common';

config();

@Injectable()
export class GoogleStrategy extends PassportStrategy(Strategy, 'google') {

 constructor() {
   super({
       clientID: &amp;lt;your-clientID&amp;gt;,
       clientSecret: &amp;lt;your-clientSecret&amp;gt;,
       callbackURL: 'http://localhost:3000/google/redirect',
       scope: ['email', 'profile'],
     });
 }


 async validate (accessToken: string, refreshToken: string, profile: any, done: VerifyCallback): Promise&amp;lt;any&amp;gt; {
   const { name, emails, photos } = profile
   const user = {
     email: emails?.at(0).value,
     firstName: name?.givenName,
     lastName: name.familyName,
     picture: photos?.at(0).value,
     accessToken
   }
   done(null, user);
 }
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;2.1 — Go to console.google.com in your browser&lt;/p&gt;

&lt;p&gt;2.2 — From side bar, go to API &amp;amp; Services -&amp;gt; Credentials&lt;/p&gt;

&lt;p&gt;2.3 — Now, Click on create credentials and select OAuth Client ID&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjaq4ro4czl4o9pv1auly.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjaq4ro4czl4o9pv1auly.png" alt="Image description" width="800" height="173"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;2.4 — After creating the client id and client secret, add it in your googleStrategy.ts file&lt;/p&gt;

&lt;p&gt;3- Import googleStrategy in your module&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { GoogleStrategy } from './services/google.strategy';

@Module({
 ../
 providers: [GoogleStrategy],
})

export class AppModule { }

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;4- Setup your service file&lt;/p&gt;

&lt;p&gt;src/app.service.ts&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { Injectable } from '@nestjs/common';

@Injectable()
export class AppService {

 googleLogin(req) {
   if (!req.user) {
     return 'No user from google'
   }

   return {
     message: 'User information from google',
     user: req.user
   }
 }
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;5- Setup your routes for social login using google&lt;/p&gt;

&lt;p&gt;src/app.app.controller.ts&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { 
  Body, 
  Controller, 
  Get, 
  HttpStatus, 
  Post, 
  Req, 
  UseGuards
} from '@nestjs/common';
import { AppService } from './app.service';
import { AuthGuard } from '@nestjs/passport';

@Controller()
export class AppController {
 constructor(private readonly appService: AppService) {}

 @Get("auth/google")
 @UseGuards(AuthGuard('google'))
 async googleAuth(@Req() req) {}


 @Get('google/redirect')
 @UseGuards(AuthGuard('google'))
 googleAuthRedirect(@Req() req) {
   return this.appService.googleLogin(req)
 }
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, you can login using google at following URL.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://localhost:3000/auth/google" rel="noopener noreferrer"&gt;http://localhost:3000/auth/google&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Congratulations, Now you have implemented social login using google in Nest JS.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Over the air (OTA) update using Revopush in react native</title>
      <dc:creator>Asim Mehmood</dc:creator>
      <pubDate>Thu, 15 May 2025 10:47:43 +0000</pubDate>
      <link>https://dev.to/asim_mehmood_275a2236b23e/over-the-air-ota-update-using-revopush-in-react-native-2h3f</link>
      <guid>https://dev.to/asim_mehmood_275a2236b23e/over-the-air-ota-update-using-revopush-in-react-native-2h3f</guid>
      <description>&lt;p&gt;In this article, we will learn what is over the air updates and how to configure and use over the air updates feature in react native app.&lt;/p&gt;

&lt;p&gt;An OTA (Over-The-Air) update refers to the process of delivering and applying updates to your React Native application directly to users’ devices without requiring them to go through the traditional app store update process (i.e., Google Play Store or Apple App Store).&lt;/p&gt;

&lt;p&gt;Instead of bundling all your JavaScript, assets (like images and fonts), and potentially native code into a new app binary that needs to be submitted, reviewed, and then downloaded by users from the app stores, an OTA update allows you to push changes to these elements directly to the installed app&lt;/p&gt;

&lt;p&gt;1-Installation&lt;br&gt;
First of all, you have to install you have to install the revopush package using following command&lt;/p&gt;

&lt;p&gt;For NPM&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm i @revopush/react-native-code-push

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For Yarn&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;yarn add @revopush/react-native-code-push
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, configure the package according to the version of react native your app is using.&lt;/p&gt;

&lt;p&gt;2 - Follow the instructions from the docs according to the variant&lt;/p&gt;

&lt;p&gt;For configuration in IOS&lt;br&gt;
&lt;a href="https://github.com/revopush/react-native-code-push/blob/master/docs/setup-ios.md" rel="noopener noreferrer"&gt;https://github.com/revopush/react-native-code-push/blob/master/docs/setup-ios.md&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For configuration in Android&lt;br&gt;
&lt;a href="https://github.com/revopush/react-native-code-push/blob/master/docs/setup-android.md" rel="noopener noreferrer"&gt;https://github.com/revopush/react-native-code-push/blob/master/docs/setup-android.md&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3 - Wrapping the App with Revopush&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;For Automatic updates checking and installation&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let codePushOptions = { checkFrequency: codePush.CheckFrequency.ON_APP_RESUME };

let MyApp: () =&amp;gt; {
  render(){
    return {
      &amp;lt;View&amp;gt;
      &amp;lt;/View&amp;gt;
    }
  }
}

MyApp = codePush(codePushOptions)(MyApp);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For manual updates checking and installation&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let codePushOptions = { checkFrequency: codePush.CheckFrequency.MANUAL };

const MyApp = () =&amp;gt; {
  const onButtonPress = () =&amp;gt; {
    codePush.sync({
      updateDialog: true,
      installMode: codePush.InstallMode.IMMEDIATE
    });
  }
  render() {
    return (
      &amp;lt;View&amp;gt;
        &amp;lt;TouchableOpacity onPress={this.onButtonPress}&amp;gt;
          &amp;lt;Text&amp;gt;Check for updates&amp;lt;/Text&amp;gt;
        &amp;lt;/TouchableOpacity&amp;gt;
       &amp;lt;/View&amp;gt;
      )
   }
}

MyApp = codePush(codePushOptions)(MyApp);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;3.1 - CodePush Options&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;checkFrequency&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Controls when the app checks for updates.&lt;/p&gt;

&lt;p&gt;codePush.CheckFrequency.MANUAL (you manually trigger check)&lt;br&gt;
codePush.CheckFrequency.ON_APP_START (default)&lt;br&gt;
codePush.CheckFrequency.ON_APP_RESUME&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;InstallMode&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Controls when the update gets applied after download.&lt;/p&gt;

&lt;p&gt;codePush.InstallMode.IMMEDIATE: Apply update right away (may reload app).&lt;br&gt;
codePush.InstallMode.ON_NEXT_RESTART: Apply next time app is restarted.&lt;br&gt;
codePush.InstallMode.ON_NEXT_RESUME: Apply when app resumes after going to background.&lt;br&gt;
codePush.InstallMode.ON_NEXT_SUSPEND: Apply after system suspends the app.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Manual Methods&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you set checkFrequency: MANUAL, you can control everything programmatically:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;codePush.sync({
  installMode: codePush.InstallMode.IMMEDIATE,
  updateDialog: true,
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;4 - Revopush CLI installation&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Now, we have to install Revopush CLI to access and use Revopush using our terminal / CLI.&lt;/p&gt;

&lt;p&gt;To install Revopush, use the following command&lt;/p&gt;

&lt;p&gt;For NPM&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install -g @revopush/code-push-cli
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For Yarn&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;yarn add -g @revopush/code-push-cli

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Login to Revopush CLI using the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;revopush login
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You will be prompted to the browser with an access key. Copy the access key from browser and paste the key in the terminal from where you are trying to login.&lt;/p&gt;

&lt;p&gt;Now, you are logged in.&lt;/p&gt;

&lt;p&gt;Note: From browser,you can also access your revopush dashboard at this URL &lt;a href="https://app.revopush.org/" rel="noopener noreferrer"&gt;https://app.revopush.org/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To get a detailed information regarding revopush CLI, you can checkout the documentation&lt;/p&gt;

&lt;p&gt;&lt;a href="https://docs.revopush.org/cli/getting-started" rel="noopener noreferrer"&gt;https://docs.revopush.org/cli/getting-started&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Create an App on RevoPush&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Now, create an app on revopush using your revopush dashboard or revopush CLI&lt;/p&gt;

&lt;p&gt;For creating app using CLI, use the following command. Replace the appName with the name you want to create the app.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Command syntax: revopush app add &amp;lt;appName&amp;gt;
Command example: revopush app add MyAppIOS
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, your app is created on revopush dashboard. You can verify by checking the applications tab in your dashboard.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Releasing updates using revopush&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Now, you can release updates using the following commands&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Command syntax: revopush release-react &amp;lt;appName&amp;gt; &amp;lt;platform ios/android&amp;gt;

Command example: revopush release-react MyApp android -d Production
Command example: revopush release-react MyApp ios -d Production
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Congratulations, Now you have configured the over the air update feature in your react native app.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
