Rails google oauth2 google drive API with my own account - ruby-on-rails

I'm having some difficulty understanding how to use the google api with my rails app. I've already setup devise and oauth2 where I can authenticate and create google users.
The problem is that I want to create folders, documents, and spreadsheets on my own account.
So I want my user to click "create document" and I want to create a document, save it to my own Gdrive and share the edit link.
Is there a way to get a permanent oauth2 token for myself and then use it? How would you go about setting that up.
I will have to make sure the scope is setup for drive and docs when authenticating but that's as far as I got while reading up here:
https://github.com/gimite/google-drive-ruby#readme
and I'm using this for oauth2 with devise so already have client info:
https://github.com/zquestz/omniauth-google-oauth2
I think I have most of the infrastructure but need that extra push to get my own permanent tokens and figure out how to make my own model that will interact with google.
Any help appreciated.

Related

Integrate my own IDP (Similar to okta) and CIAM into BigCommerce store

I have my own IDP and user store which is used by other apps in order to allow users to login. Right now i am trying to spin up a new storefront using BigCommerce ecommerce platform , for this app i need to use the existing IDP and user store so that users who are using the other apps can single sign-on into the new store front app as well. Can anyone please help on where to start on?
I also had a look into the big commerce Login API using which once can able to login using JWT token for the customers existing already in Bigcommerce platform, But in my case all my user data are store in my custom IAM and i need to log those users into store front seamlessly.
Thanks in advance
You need to provide BC Login API with a signed JWT. That JWT needs to contain the BigCommerce userId to enable it to login. To create the JWT you will need a client ID that can be created by creating an app in your developer account, thus creating the trust and not requiring credentials, just a userId.
This gives some help on creating the JWT and all the info required within it:
https://developer.bigcommerce.com/api-docs/storefront/customer-login-api
And this is a simple example of it working using Express middleware and Auth0:
https://github.com/bc-simonpallister/bc-auth0-oidc
For BigCommerce Single Sign On (SSO), you can definitely use the following information mentioned - https://developer.bigcommerce.com/api-docs/storefront/customer-login-api
But as I understand, you are also looking for a seamless solution for BigCommerce SSO wherein you can skip the complex coding part.
If this was interesting, here is the entire scoop for your reference -
https://www.miniorange.com/integrations/bigcommerce-sso-mfa
PS: You can also enable auto sync using above solution in case you wish to provision your users/groups in future.

Social login concept and best practice

I have started building a website on Laravel and I wanted to include social Login to my site.
I have a basic understanding of how this works. I used Socialite and Google API and followed the documentation and setup a login route to google and was able to get a response with token and other details.
This is where I am stuck. I wan't to build a robust user system. I need help in understanding the best concept for Social login.
For example,
when a user logs in from google, do I need to save the token. Do I need to create an entry in the database and save as a user or should I just load the user information every time from what is returned by the API.
Also, what is the difference between social login and sing up with social login?
Ultimately, I would like to build a site with user profiles and I would like to get as much information from API's as possible and setup the user system in efficient way.
Any help is much appreciated

is it possible to use Google OAuth without using the google sign in page?

I'm trying to figure out a way to authenticate using google Oauth without using the google sign in page. I would like to have a separate sign in page for my UI. And my backend will get the email and password from the and authenticate with google. But the problem i'm running into is that when I'm using google oauth it tries to open the google sign in page. Is there a way to achieve this without using the google sign in page ?
Thank you !
You really don't want to do this. One of the big selling points of OAuth2 is that you can delegate the ownership of identity and credential management. Users shouldn't give their Google passwords to anyone, except Google :)

Linking Google Assistant with Firebase Auth

I am attempting to connect a Google Assistant app using DialogFlow(Api.AI) with Firebase Auth. My App uses Firebase Auth to maintain user accounts and the realtime database to store data. I would like to be able to make changes to a user's data through the Google Assistant, maybe using something like a cloud function. In order to make any user changes through Google Assistant, I need to link the user's Google Assistant account with their Firebase Auth account. The current mechanism appears to be using an OAuth flow documented here.
The question I have is, what is the best way to accomplish this? Do I need to set up a custom OAuth server? There is a lot of documentation on Google's cloud website about OAuth, but it all appears to be related to using OAuth to access Google's APIs, and I can't really see a simple way to host this linking mechanism in GCP.
There is this question that is pretty close, but the difference I have is that I don't have an external API, I just want to authenticate my user and be able to modify their data in the realtime database.
Thank you for your help!
here is an example: https://github.com/malikasinger1/Quiz-Assistant
i have done it myself with following best practices,
feel free to comment if you don't understand something.

How do I authenticate a user if they are not using my web (rails) application, e.g. using an API

I have created a Rails (3.2) application that uses the OmniAuth gem to provide OAuth authentication. Users can log into the site using their Twitter, Facebook or Google credentials, pretty bog-standard functionality.
I now want to make the data available via an API so it can be consumed outside of my web application, however, users would still have to login to be able to access their data. How do I do this in my Rails APP? And what would the user have to do to be able to call this?
UPDATE
Some people are suggesting "alternative" authentication methods, but I am wondering if I cannot use the same OAuth credentials I already have for them. I don't want them to have to provide another username/pwd, I want them to be able to use their Twitter, Facebook or Google Identities as they do when they use the WebUI.
authenticate_with_http_basic (or digest if you like) might work for you, called from a before filter in the controller.
You can test with curl, using the --user parameter.
Here's a good thread on the topic:
In Ruby on Rails, what does authenticate_with_http_basic do?
Devise has the feature token authentication which is what you are looking for.
Also visit http://zyphmartin.com/blog/simple-auth-token-example-with-devise

Resources