Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use Google OAuth with Deno js?

Is there some libraries or modules for Google OAuth in Deno.js? I am trying to impelemnt google login on my web application and use this google account for uploading youtube videos in deno.js.

I am grateful for any help!

like image 383
Jovan Aritonovic Avatar asked Jul 10 '20 11:07

Jovan Aritonovic


People also ask

What OAuth protocol does Google API use?

Google APIs use the OAuth 2.0 protocol for authentication and authorization. Google supports common OAuth 2.0 scenarios such as those for web server, client-side, installed, and limited-input device applications. To begin, obtain OAuth 2.0 client credentials from the Google API Console.

What types of OAuth does Google support?

Google supports common OAuth 2.0 scenarios such as those for web server, client-side, installed, and limited-input device applications. To begin, obtain OAuth 2.0 client credentials from the Google API Console.

Can you use OAuth with JavaScript?

Client-side (JavaScript) applications. The Google OAuth 2.0 endpoint supports JavaScript applications that run in a browser. The authorization sequence begins when your application redirects a browser to a Google URL; the URL includes query parameters that indicate the type of access being requested.

How do I get OAuth credentials from Google?

Obtain OAuth 2.0 credentials from the Google API Console. Visit the Google API Console to obtain OAuth 2.0 credentials such as a client ID and client secret that are known to both Google and your application. The set of values varies based on what type of application you are building.


2 Answers

I think a generic solution for OAuth doesn't exist yet. However, if you can override the default implementation, you can try authlete_deno_fen_oauth_server third party module.

There is a generic oauth2 module but not available at the moment.

If the above option doesn't work, try using an npm module in deno as described in this stackoverflow thread and follow this medium article to achieve your goal.

like image 127
DevLoverUmar Avatar answered Nov 15 '22 01:11

DevLoverUmar


Have a look at youtube-deno. I haven't used it myself, but it seems like it provides a good interface for communicating with the Youtube API with deno.


Here's an example from the readme:

// A simple example to call the search_list() function and log the response json.
import { YouTube } from "https://x.nest.land/[email protected]/mod.ts";

let obj = new YouTube("your-api-key-here", false);

obj.search_list({part: "snippet", q: "the coding train"}).then(function(response){
 console.log(response);
});
like image 40
thewizardbear Avatar answered Nov 15 '22 01:11

thewizardbear